Welcome, Guest
Username: Password: Remember me
Use this Category for your support questions about Virtuemart Template - CleanMart (SKU# FLEX-00015)

TOPIC: Tutorial 1: Show manufacturer LOGOs

Tutorial 1: Show manufacturer LOGOs 10 years 6 months ago #6660

Hi,

With CleanMart, it is possible to show Manufacturer LOGOs in the category browse page and product details page.

This patch is only for VM2.x (not necessary for VM3.0.x)

You might know, this feature doesn't included to Virtuemart by default, and it comes with our VM Template. Therefore some lines need to be inserted to a Core Virtuemart PHP file in order to load the manufacturer logo in the category browse page and product details page.

The PHP file you need to make edits is located here:
/administrator/components/com_virtuemart/models/product.php

Look at the lines around 1005th line (with VM2.0.26), and find these lines:
if (!empty($product->virtuemart_manufacturer_id)) {
	$mfTable = $this->getTable ('manufacturers');
	$mfTable->load ((int)$product->virtuemart_manufacturer_id);
	$product = (object)array_merge ((array)$mfTable, (array)$product);
}

replace them with these:
if (!empty($product->virtuemart_manufacturer_id)) {
	$mfTable = $this->getTable ('manufacturers');
	$mfTable->load ((int)$product->virtuemart_manufacturer_id);
	$xrefTable = $this->getTable('manufacturer_medias');
	$mfImages = $xrefTable->load($product->virtuemart_manufacturer_id);
	if(!empty($mfImages)) {$mfTable->mf_image_id = $mfImages[0];
		$mediaModel = VmModel::getModel('Media');
		$product->mf_images = $mediaModel->createMediaByIds($mfImages[0],'','image');		
	}
	$product = (object)array_merge ((array)$mfTable, (array)$product);
}


And that's it. You will be good to go.
If Official VM Developers decide to include this feature to Virtuemart by default in one of next releases, than Wohooo, you won't need any coding modifications, Otherwise you will have to repeat this Coding modifications every time you update your Virtuemart. Since with a Virtuemart update; every PHP file in /administrator/components/com_virtuemart/ refreshes itself and all modifications are gone.


Regards.
Flexible Support Team.
Last Edit: 8 years 3 months ago by Support.
The administrator has disabled public write access.

Tutorial 1: Show manufacturer LOGOs 8 years 4 months ago #13438

Hi,
I think I found a bug in file flexv2.php

In line 280, 547 and 852 the following code
alt="'.$this->product->mf_name

should be replaced with
alt="'.$product->mf_name

Am I wrong?

Thanks,
Bruno
The administrator has disabled public write access.

Tutorial 1: Show manufacturer LOGOs 8 years 4 months ago #13442

hi,

Yes you are right. Within the "Category Page", $this->product object is not exist, it should have been $product. This is a typo we have made during the development. I am glad you noticed that.

So, within these files:
/templates/YOUR_TEMPLATE/html/com_virtuemart/category/default.php
/templates/YOUR_TEMPLATE/html/com_virtuemart/category/flexv2.php


Search for this expression (use CTRL+F)
$this->product->mf_name

and replace it with this:
$product->mf_name

everything will be good to go.

Regards.
Last Edit: 8 years 4 months ago by Support.
The administrator has disabled public write access.
Time to create page: 0.208 seconds

MaterialMart

for Virtuemart 3

Google's Material Design has finally arrived to Virtuemart

Virtumart Template - MaterialMart Virtumart Template - CleanMart Virtumart Template - CleanMart Virtumart Template - CleanMart

Fully responsive!

Buy Now   |   Live Demo