VirtueMart Forum

VirtueMart 2 + 3 + 4 => Templating & Layouts => Topic started by: rizecorp on December 04, 2013, 12:37:50 PM

Title: Need Itemid's for the related products in the add to cart pop up
Post by: rizecorp on December 04, 2013, 12:37:50 PM
Hi All,

I have configured the related products to display. But i need to customize as below:
1) Need to replace the "Product Names" with "Product SKU's" for the related products under product details page.
2) Need Itemid's for the related products image and name links showing on the show cart pop up.
3) Need to replace the "Product Names" with "Product SKU's" for the related products on the show cart pop up.

Please let me know if anybody knows. Please go through the attachments for more details.
(http://forum.virtuemart.net/index.php?action=dlattach;topic=120714.0;attach=57417)

(http://forum.virtuemart.net/index.php?action=dlattach;topic=120714.0;attach=57419)

Version Details:
1) MySQL    :  5.5.32-cll
2) PHP      :  5.3.23
3) Joomla   :  2.5.16
4) Virtuemart: 2.0.24c


Thanks in advance...

[attachment cleanup by admin]
Title: Re: Need Itemid's for the related products in the add to cart pop up
Post by: rizecorp on December 05, 2013, 09:04:46 AM
Hi All,

Is anybody has the solution for my requirement above. Please let me know.

Thanks in advance..
Title: Re: Need Itemid's for the related products in the add to cart pop up
Post by: GJC Web Design on December 05, 2013, 22:52:39 PM


product name as the link text is hard coded that way in the administrator\components\com_virtuemart\models\customfields.php

you could either hack that line 1138

return JHTML::link (JRoute::_ ('index.php?option=com_virtuemart&view=productdetails&virtuemart_product_id=' . $related->virtuemart_product_id . '&virtuemart_category_id=' . $related->virtuemart_category_id,FALSE), $thumb   . $related->product_name, array('title' => $related->product_name));

to

return JHTML::link (JRoute::_ ('index.php?option=com_virtuemart&view=productdetails&virtuemart_product_id=' . $related->virtuemart_product_id . '&virtuemart_category_id=' . $related->virtuemart_category_id,FALSE), $thumb   . $related->product_sku, array('title' => $related->product_name));

I think to get the Itemid in the popup will be difficult - the html for the related is preformed in the model above as
$this->product->customfieldsRelatedProducts->display

a quick test in components/com_virtuemart/views/cart/tmpl/padded.php (the popup template )  with $itemid = JRequest::getVar('Itemid'); is blank ..
so the popup can't get the Itemid even from the JFramework

so super fancy jquery find and replace???  :-\