Shopping Basket


 x 

Cart empty


Log In

Find Us Elsewhere

Forum Search

Keyword

Error in Model Concerning "Hidden" Products

  • sanos
  • sanos's Avatar Topic Author
  • Offline
  • Fresh Boarder
  • Fresh Boarder
More
1 year 4 months ago #3501 by sanos
sanos created the topic: Error in Model Concerning "Hidden" Products
Hello folks,

today I bought the googlebasexml component. Unfortunately I directly had to discover an error in GooglebasexmlModelGooglebasexml leading to a PHP Notice in line 648: "Undefined property: TableProducts::$canonCatId". I started troubleshooting and found out that it occured because some of the products in my shop were configured to be visible only to a certain subset of registered customers (i.e. bulk products only available for retailers).
The Googlebasexml model accesses the VM models as a guest - just like it should - because "private" products are not supposed to be visible in Google Shopping. So this obviously works just fine. Nonetheless the VirtueMartModelProduct model is accessed anyway for these products returning an nearly empty object indicating access restrictions. Because the GooglebasexmlModel does not check this case it leads to an access to an undefined property in line 648 "$cid = $product->canonCatId;" resulting in the notification I received.

I would suggest to use the virtuemart_product_id property of the object returned by VirtueMartModelProduct::getProduct() as a surrogate marker for access restrictions and as the case may be skip the given product.

// at line 570
$product = $productModel->getProduct($productId->id); // this one was already there
if(!isset($product->virtuemart_product_id) || !$product->virtuemart_product_id) continue; // and this line is new

This workaround absolutely met my requirements and I hope it is not too "hackish" though it does not leave the option to explicitly include these "hidden products". I am looking forward to read your answers to this post. Thank you very much.

Greetings from Germany,
Fabian

Please Log in or Create an account to join the conversation.

  • sanos
  • sanos's Avatar Topic Author
  • Offline
  • Fresh Boarder
  • Fresh Boarder
More
1 year 4 months ago #3502 by sanos
sanos replied the topic: Error in Model Concerning "Hidden" Products
I am sorry. I posted this topic into the wrong forum. It would be really great if one of the mods could move it to the VirtuemartExtensions Support Questions forum. Thank you.

Please Log in or Create an account to join the conversation.

More
1 year 4 months ago #3503 by boggler
boggler replied the topic: Error in Model Concerning "Hidden" Products
Don't worry about posting in the wrong forum, a lot of people do.

Thanks for reporting the issue, and for suggesting the solution. I think it is a reasonable one, and we will include it, or something similar, in the next release.

Please Log in or Create an account to join the conversation.

Moderators: boggler
Time to create page: 0.205 seconds