News:

Looking for documentation? Take a look on our wiki

Main Menu

[SOLVED]Related products shows current and related product

Started by diri, April 04, 2017, 08:40:50 AM

Previous topic - Next topic

diri

Testing with Joomla! 3.6.5 and Virtuemart 3.2.1:

Related products are shown below product. That's fine so far.

Trouble is:
- I can't get language override working to get rid of standard phrases.
- In related products it shows name of current product AND name of related product.

In image attached AMS 125 ELIXIR CR is current product. Other ones are related.

Any help appriciated. :D

diri

Forgot to mention:

Names displayed are stored in image description / name and the like at each product.

diri

Ok, had a little time to think about problem with names shown:

Virtuemart stores meta information related to product images in _virtuemart_medias.

In case a manufacturer provides one image for several products and you "forget" to generate a separate copy of the image for each product but enter correct description at product level things get messed up.

Must find files to override image_desc and the like in whole virtuemart for this...

Problem with overriding language persists.

btw: Situation with image descriptions might be a problem with international shops as well.

CE WebDesign München

to hide current product in related products (or to give it a style etc.):

1. add a unique css-class to product-page in MY_TEMPLATE\html\com_virtuemart\productdetails\default.php on first div:

<div class="productdetails-view productdetails product-container my-unique-product-class-<?php echo $this->product->virtuemart_product_id ?>">


2.  add unique css-classes to related-products in MY_TEMPLATE\html\com_virtuemart\sublayouts\related.php
and hide if match (customised related.php vm 3.0.18):


<?php defined('_JEXEC') or die('Restricted access');

$document JFactory::getDocument();

$related $viewData['related'];
$customfield $viewData['customfield'];
$thumb $viewData['thumb'];

$document->addStyleDeclaration('.my-unique-product-class-' $related->virtuemart_product_id ' .my-unique-related-product-class-' $related->virtuemart_product_id ' { display: none; }');

//juri::root() For whatever reason, we used this here, maybe it was for the mails
echo JHtml::link (JRoute::('index.php?option=com_virtuemart&view=productdetails&virtuemart_product_id=' $related->virtuemart_product_id '&virtuemart_category_id=' $related->virtuemart_category_id), $thumb $related->product_name, array('class' => 'my-unique-related-product-class-' $related->virtuemart_product_id,'title' => $related->product_name));
if(
$customfield->wPrice){
$currency calculationHelper::getInstance()->_currencyDisplay;
echo $currency->createPriceDiv ('salesPrice''COM_VIRTUEMART_PRODUCT_SALESPRICE'$related->prices);
}
if(
$customfield->wDescr){
echo '<p class="product_s_desc">'.$related->product_s_desc.'</p>';
}
CE WebDesign München: https://ce-webdesign.de | Websites, eCommerce WebShops | Responsive Design | SEO

diri

gogo32, thank you very much.

Here is a proof of concept to show problem with international shops when product name has to be translated (no matter images are for one or multiple products):

update j25_virtuemart_medias
join j25_virtuemart_product_medias on j25_virtuemart_medias.virtuemart_media_id = j25_virtuemart_product_medias.virtuemart_media_id
join j25_virtuemart_products_de_de on j25_virtuemart_product_medias.virtuemart_product_id = j25_virtuemart_products_de_de.virtuemart_product_id
set j25_virtuemart_medias.file_title = j25_virtuemart_products_de_de.product_name,
j25_virtuemart_medias.file_meta = j25_virtuemart_products_de_de.product_name,
j25_virtuemart_medias.file_description = j25_virtuemart_products_de_de.product_name;

Switch to another language (not german) than.

CE WebDesign München

please new topic per issue ;)
(and mark [SOLVED] if solved)
CE WebDesign München: https://ce-webdesign.de | Websites, eCommerce WebShops | Responsive Design | SEO