Instead of the default message when no related products are present, I'd like to add a link to direct shoppers back to the item's parent category as the "fallback". I would just like for there to be an option to direct the customer somewhere if they have taken the time to click the tab and expect to see something. Is this possible? I'm using 1.4.7.
STONEHINGED
Handcrafted, Semi-Precious Jewelry
http://www.stonehinged.com/
Go to catalog/view/theme/default/template/product/product.tpl
Search for this line of code:
Edit the echo directly, or just replace the php with an html URL like this:
If you want to go back to the category from whence they left then just set a session variable holding the name of the category and path. route=product/category&path=bla bla bla. You will want to set this session variable in your category.php file because that is the control for going from a category to an actual product and especially because if you are using SEO URL' it will have time to convert.
Search for this line of code:
Code: Select all
<?php echo $text_no_related; ?>
Code: Select all
<a href="Your link back to parent category">Back To Products</a>
Code: Select all
<a href="<?php echo $_SESSION['parent_category'];?>">Back To Products</a>
Thanks avvici, I definitely want it dynamic but unfortunately, I'm not much of a programmer. I can follow your suggestion somewhat, but not sure I can pull it off without more detail. Sad to say, perhaps the code for copy/paste
STONEHINGED
Handcrafted, Semi-Precious Jewelry
http://www.stonehinged.com/
I did not hear from you so just follow these directions and you will achieve what you need to do:
Open catalog/controller/product/category.php and search for the following array:
Right after that array insert the following code:
That will set the session variable that you need to reference on the TPL. MAKE SURE THAT YOU PLACE IT BETWEEN THE ENDING CURLEY BRACKET FROM THE ARRAY, AND THE ENDING CURLEY BRACKET FROM THE FUNCTION THE ARRAY IS IN so it total it will look like this:
Now open the file: catalog/view/theme/default/template/product/product.tpl and find the following code:
Replace that with this and you will be done:
Open catalog/controller/product/category.php and search for the following array:
Code: Select all
$this->data['products'][] = array(
'name' => $result['name'],
'model' => $result['model'],
'rating' => $rating,
'stars' => sprintf($this->language->get('text_stars'), $rating),
'thumb' => $this->model_tool_image->resize($image, $this->config->get('config_image_product_width'), $this->config->get('config_image_product_height')),
'price' => $price,
'options' => $options,
'special' => $special,
'href' => $this->model_tool_seo_url->rewrite(HTTP_SERVER . 'index.php?route=product/product&path=' . $this->request->get['path'] . '&product_id=' . $result['product_id']),
'add' => $add
);
Code: Select all
//Begin Set Category Path Session Variable
$this->session->data['cat_path']=$this->model_tool_seo_url->rewrite(HTTP_SERVER . 'index.php?route=product/category&path=' . $this->request->get['path'] . '_' . $result['category_id'] . $url);
//End Set Category Path Session Variable
Code: Select all
$this->data['products'][] = array(
'name' => $result['name'],
'model' => $result['model'],
'rating' => $rating,
'stars' => sprintf($this->language->get('text_stars'), $rating),
'thumb' => $this->model_tool_image->resize($image, $this->config->get('config_image_product_width'), $this->config->get('config_image_product_height')),
'price' => $price,
'options' => $options,
'special' => $special,
'href' => $this->model_tool_seo_url->rewrite(HTTP_SERVER . 'index.php?route=product/product&path=' . $this->request->get['path'] . '&product_id=' . $result['product_id']),
'add' => $add
);
//Begin Set Category Path Session Variable
$this->session->data['cat_path']=$this->model_tool_seo_url->rewrite(HTTP_SERVER . 'index.php?route=product/category&path=' . $this->request->get['path'] . '_' . $result['category_id'] . $url);
//Begin Set Category Path Session Variable
}
Code: Select all
<?php echo $text_no_related; ?>
Code: Select all
<a href="<?php echo $_SESSION['cat_path'];?>">Back To Products</a>
Thanks so much avvici, I greatly appreciate your time and help. It's the community and folks like you that make using OC so great, especially us that are trying to pick up the code and knowledge as we go. I marvel at what you folks do! Thanks again!
STONEHINGED
Handcrafted, Semi-Precious Jewelry
http://www.stonehinged.com/
Hey there, I currently have 3 categories on the top and then 10 down the side ... I would like the 10 down the side as a drop down at the top but to also keep down the side .... if I add them to a parent category they disappear from the side ... is there anyway I can have them both at the top and down the side ?
Who is online
Users browsing this forum: No registered users and 33 guests