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

TOPIC: product->mf_name always points to 1st manufacturer

product->mf_name always points to 1st manufacturer 8 years 4 months ago #13563

Hi,
in default.php and flexv2.php subtemplates (both product and category) $product->mf_name and $this->product-mf_name always contain the name of the first manufacturer.
This means that the ALT labels for manufacturers' logo pictures are wrong as well as the category title when you show a single manufacturer.

I checked your demo, and in your case they are set OK.
I don't know if it's a problem with VM 3.0.12.
I made a quick fix by adding a function that reads the correct name in FlexibleMartGlobal.php and used it in default.pxp and flexv2.php:
/* Get URL safe Manufacturer name */
function getManufName($virtuemart_manufacturer_id ){
 
	static $manNamesCache = array();
	if(empty($virtuemart_manufacturer_id)) return false;
	if(!isset($manNamesCache[$virtuemart_manufacturer_id])){
		$db = JFactory::getDBO();
		$query = 'SELECT `slug` FROM `#__virtuemart_manufacturers_'.VmConfig::$vmlang.'` WHERE virtuemart_manufacturer_id='.(int)$virtuemart_manufacturer_id;
		$db->setQuery($query);
		$manNamesCache[$virtuemart_manufacturer_id] = $db->loadResult();
	}
	return ucfirst( $manNamesCache[$virtuemart_manufacturer_id] );
}

Howerver there should be a better solution as the mf_name must be set correctly somewhere...

Just to let you know in case other users experience the same problem.

Bruno
The administrator has disabled public write access.

product->mf_name always points to 1st manufacturer 8 years 3 months ago #13568

hmmm. weird. Because the Live Demo of CleanMart (demo.flexiblewebdesign.com/cleanmart/) also uses VM3.0.12.. so it can't be the Virtuemart nor CleanMart.. Must be something else goes wrong about your Virtuemart setup.

$product->mf_name is the official way (VM Core) to get the name of the Manufacturer. I can't think of anything why it fails.. Did you check forum.virtuemart.net about it?

The function you created looks fine to me though. It is like reinventing the wheel; but as long as it works, i wouldn't mind ;)


BUT!! there is one more thing. Did you follow this tutorial:
www.flexiblewebdesign.com/forum-virtuemart-2-template-support/1409-tutorial-1-show-manufacturer-logos ?

IF you did, retrieve your changes back to stock.. Because that patch has been added to Core Virtumart and extra coding injection is not necessary anymore (that coding injection is only for VM2.6+)

Regards.
The administrator has disabled public write access.

product->mf_name always points to 1st manufacturer 8 years 3 months ago #13573

Hi,
yes, I had applied the patch. Now I removed it and manufacturers' logos are ok.

Still the problem with product->mf_name remains.
Not a big problem since I solved it in another way, but strange...

Bruno
The administrator has disabled public write access.

product->mf_name always points to 1st manufacturer 8 years 3 months ago #13577

I agree, it is a bit weird. But i highly believe it has something to do with your specific Virtuemart store - OR - a silly db table conflict caused by a VM update (especially if you did upgrade from VM2.x to VM3.x). I highly doubt it was a general VM issue.

For the forum clearance, i am closing this topic and marking this case as "solved"

Regards.
Last Edit: 8 years 3 months ago by Support.
The administrator has disabled public write access.
Time to create page: 0.110 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