Forum Search
- Forum
- Support Questions
- Virtuemart Extensions Support Questions
- Error in Model Concerning "Hidden" Products
Error in Model Concerning "Hidden" Products
- sanos
- Topic Author
- Offline
- Fresh Boarder
Less
More
- Posts: 2
- Thank you received: 0
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.
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
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
- Topic Author
- Offline
- Fresh Boarder
Less
More
- Posts: 2
- Thank you received: 0
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.
- boggler
- Offline
- Moderator
Less
More
- Posts: 1146
- Karma: 18
- Thank you received: 132
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.
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
- Forum
- Support Questions
- Virtuemart Extensions Support Questions
- Error in Model Concerning "Hidden" Products
Time to create page: 0.205 seconds