News:

Looking for documentation? Take a look on our wiki

Main Menu

RELATED PRODUCTS BY SKU

Started by djanael, July 01, 2015, 22:22:08 PM

Previous topic - Next topic

djanael

How to?

<?php if (JRequest::getVar('$this->product->virtuemart_product_sku')=='$THIS->product->virtuemart_product_sku') { ?>
<div id="productmod"><jdoc:include type="modules" name="productdetails" /></div>
<?php } ?>

=/ not show...

PRO

please explain better what you want to do?


& what versions of vmart & joomla are you using?


djanael

#2
vm3.0.9.4, joomla 3.4.3

I need to modify the module that lists the products so that list based on the product's SKU code


UPDATE

  • Create a CUSTOM FIELD - VARIANT DEPENDENT GENERIC - MARK as hidden
  • ADD CHILDRENs TO PRODUCT
  • In the tab Custom Field ADD your Custom Field - MARK THIS FIELD AS FATHER MAY BE REQUESTED

<?php
$productModel 
VmModel::getModel ('product');
$productModel->setId($this->product->virtuemart_product_id);
$uncatChildren $productModel->getUncategorizedChildren ($customfield->withParent);
$mediaModel VmModel::getModel ('Media');
if(
count($uncatChildren)>0) {
foreach ($uncatChildren as $child) {
$M_link JRoute::('index.php?option=com_virtuemart&view=productdetails&virtuemart_category_id=' $this->product->virtuemart_category_id '&virtuemart_product_id=' $child['virtuemart_product_id'],FALSE);

//getFiles() SAYS is meant only for backend use but i couldnt find any other function.
$M_images $mediaModel->getFiles(truefalse$child['virtuemart_product_id']); 
$M_thumb $M_images[0]->file_url_thumb;
$M_full $M_images[0]->file_url;

if($M_thumb!='') {
$M_image $M_thumb;
} elseif($M_full!='') {
$M_image $M_full;
} else {
//Pull default image here
}
$f_img[] = '<div style="float:left;""><a href="'.$M_link.'" title="'.htmlentities($child['product_name']).'"><p>"'.htmlentities($child['product_name']).'"</p><p><img src="'.$M_image.'" style="height:60px;"></p></a></div>';
}

//handle html display here
foreach($f_img as $imgval){
echo $imgval;
}
}
?>


??? Sorry about that