Hi, I know oc 1.5 is old but I'm still can not move on
So, I need a help. I want to make a button link in admin product list that will open a blank product detail in frontpage with seo url. I can do this using this in .tpl but this is not what I want because this is not seo url
<a target="_blank" href="../index.php?route=product/product&product_id=<?php echo $product_name['product_id']; ?>"><?php echo $product_name['text']; ?></a>
I've successfully make the frontpage become seo url, so the only problem is the link from admin page.
Any help please?
Hi,
In product list you can use keyword;
Assuming that SEO url is enabled then in area:
Now in tpl file, you can create new button
In product list you can use keyword;
Assuming that SEO url is enabled then in area:
Code: Select all
$this->data['products'][] = array(
'product_id' => $result['product_id'],
'name' => $result['name'],
..................................
'front_product_url' => HTTP_CATALOG . $result['keyword'],
'action' => $action
);
Code: Select all
<a href="<?php echo $product['front_product_url']; ?>" target="_blank"> View product in front store </a>
Hi,
Change like this:
Of course you can get keyword directly in getProducts function ........
Change like this:
Then in admin/model/catalog/product.php define new function'front_product_url' => $this->model_catalog_product->getProductFrontURL($result['product_id']),
Code: Select all
private function getProductKeyword($product_id) {
$sql = "SELECT keyword FROM " . DB_PREFIX . "url_alias WHERE query = 'product_id=" . (int)$product_id . "'";
$query = $this->db->query($sql);
if ($query->num_rows) {
return $query->row['keyword'];
}
return false;
}
public function getProductFrontURL($product_id) {
$keyword = $this->getProductKeyword($product_id);
$product_url = HTTP_CATALOG;
if ($keyword) {
$product_url .= $keyword;
} else {
$product_url .= 'index.php?route=product/product&product_id=' . $product_id;
}
return $product_url;
}
Who is online
Users browsing this forum: No registered users and 71 guests