News:

You may pay someone to create your store, or you visit our seminar and become a professional yourself with the silver certification

Main Menu

virtuemart_category_id contains text instead of numerical ID

Started by CZDave, July 14, 2014, 14:21:55 PM

Previous topic - Next topic

CZDave

Hi,

I am a developer of ARTIO JoomSEF and we've just noticed the following problem in VirtueMart 2.6.6 causing the virtuemart_category_id property being filled with some text instead of category numerical ID under some conditions. In the file /administrator/components/com_virtuemart/models/product.php in function getProductSingle() around line number 1074 there is the following code:
if (!empty($product->categories) and is_array ($product->categories) and array_key_exists (0, $product->categories)) {
    $product->virtuemart_category_id = $product->canonCatLink;
    //vmdebug('I take for product the main category ',$product->virtuemart_category_id,$product->categories);
}


Which (when certain conditions are met) causes the virtuemart_category_id to be set to some text obtained from the $product->product_url because of the following code around line 1042:
if(!empty($product->product_url)){
    $product->canonCatLink = $product->product_url;
}


We've fixed the problem for us by changing line 1074 from:
$product->virtuemart_category_id = $product->canonCatLink;
to:
$product->virtuemart_category_id = $product->categories[0];

Hope this helps.

Best regards,
ARTIO JoomSEF developer

Milbo

Thank you, if you check the if line before

if (!empty($product->categories) and is_array ($product->categories) and array_key_exists (0, $product->categories)) {

It was clearly meant that way.

Did you also test already vm3? There I cleaned that
Should I fix your bug, please support the VirtueMart project and become a member
______________________________________
Extensions approved by the core team: http://extensions.virtuemart.net/