Hi
I want to display short description for products in the modules like featured, bestseller etc. How can I add it? I tried to fiddle around with the controller and tpl files but got a lot of undefined errors. I also tried to compare it with the category page to see if I could get some clues but couldn't solve it. I am not really a php programmer and my knowledge in that is really limited.
Could someone please help me? I am using OC1.5.1.3
Thanks!
Vimal.
I want to display short description for products in the modules like featured, bestseller etc. How can I add it? I tried to fiddle around with the controller and tpl files but got a lot of undefined errors. I also tried to compare it with the category page to see if I could get some clues but couldn't solve it. I am not really a php programmer and my knowledge in that is really limited.
Could someone please help me? I am using OC1.5.1.3
Thanks!
Vimal.
Last edited by vimal on Mon Nov 14, 2011 2:02 am, edited 1 time in total.
www.beeshop.se
Starta webbshop, Starta e-butik, Starta e-handel
Hi,
Open catalog/controler/module/special.php
on line 50 you will see an array replace it with this
now open catalog/view/theme/your-theme/template/module/special.tpl
look for this
right after this you put this
BTW if you follow the demo link below i made a live example you will also see my free random specials module in action.
Did this solve your problem add [SOLVED] to the title of this topic.
Regards Werner
Open catalog/controler/module/special.php
on line 50 you will see an array replace it with this
Code: Select all
$this->data['products'][] = array(
'product_id' => $result['product_id'],
'thumb' => $image,
'name' => $result['name'],
'description' => $result['description'],
'price' => $price,
'special' => $special,
'rating' => $rating,
'reviews' => sprintf($this->language->get('text_reviews'), (int)$result['reviews']),
'href' => $this->url->link('product/product', 'product_id=' . $result['product_id']),
);
look for this
Code: Select all
<span class="price-old"><?php echo $product['price']; ?></span> <span class="price-new"><?php echo $product['special']; ?></span>
<?php } ?>
</div>
Code: Select all
<div><?php echo "<p>".mb_substr(strip_tags(html_entity_decode($product['description'])), 0, 150)."...</p>"; ?></div>
Did this solve your problem add [SOLVED] to the title of this topic.
Regards Werner
Hi.
I got an error message saying as below.
Line 50 is
I got an error message saying as below.
Code: Select all
Notice: Undefined variable: result in C:\xampp\htdocs\oc1511\catalog\controller\module\featured.php on line 50Notice: Undefined variable: result in C:\xampp\htdocs\oc1511\catalog\controller\module\featured.php on line 50Notice: Undefined variable: result in C:\xampp\htdocs\oc1511\catalog\controller\module\featured.php on line 50Notice: Undefined variable: result in C:\xampp\htdocs\oc1511\catalog\controller\module\featured.php on line 50
Code: Select all
'description' => $result['description'],
www.beeshop.se
Starta webbshop, Starta e-butik, Starta e-handel
And the description only shows ".." excluding the quotation mark.
www.beeshop.se
Starta webbshop, Starta e-butik, Starta e-handel
Solved it. The array looks as below.
And in the template file.
Code: Select all
$this->data['products'][] = array(
'product_id' => $product_info['product_id'],
'thumb' => $image,
'name' => $product_info['name'],
'price' => $price,
'description' => substr(strip_tags(html_entity_decode($product_info['description'], ENT_QUOTES, 'UTF-8')), 0, 100) . '..',
'special' => $special,
'rating' => $rating,
'reviews' => sprintf($this->language->get('text_reviews'), (int)$product_info['reviews']),
'href' => $this->url->link('product/product', 'product_id=' . $product_info['product_id']),
);
Code: Select all
<?php echo $product['description']; ?>
www.beeshop.se
Starta webbshop, Starta e-butik, Starta e-handel
Hi All,
Just realised that the code above for the array works for featured module only. For other modules,
Replace the line
with
difference being $result instead of $product_info
You can check in the array what is being used and use the same one.
Just realised that the code above for the array works for featured module only. For other modules,
Replace the line
Code: Select all
'description' => substr(strip_tags(html_entity_decode($product_info['description'], ENT_QUOTES, 'UTF-8')), 0, 100) . '..',
Code: Select all
'description' => substr(strip_tags(html_entity_decode($result['description'], ENT_QUOTES, 'UTF-8')), 0, 100) . '..',
You can check in the array what is being used and use the same one.
www.beeshop.se
Starta webbshop, Starta e-butik, Starta e-handel
Hi,
My code is solid but you are right that you would need a little ajustment for other modules.
Regards Werner
My code is solid but you are right that you would need a little ajustment for other modules.
Your welcomeOpen catalog/controler/module/special.php
on line 50 you will see an array replace it with this
Regards Werner
Thanks for your help. Your solution gave me a direction to start hacking :-)
www.beeshop.se
Starta webbshop, Starta e-butik, Starta e-handel
Who is online
Users browsing this forum: No registered users and 15 guests