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

Product_sku does not get updated when choosing a child with stockable products

Started by Jörgen, June 06, 2013, 12:19:23 PM

Previous topic - Next topic

Jörgen

Hello

I am trying to show the product_sku on the product details page. Using stockable child products plugin.


echo $this->product->product_sku;


But I only get the product_sku from the parent, not product_sku from the actual active child product.
When You put the child into the cart the correct product_sku appears in the cart.
I want the customer to see the correct product_sku before he puts the product into the shopping cart.
Since no one else has noticed this, I am probably the only one that is trying to display the product_sku on the product details page.  :)

The product price is correctly updated so the same thing should probably be done with the product_sku.
I am quite sure the problem is in the plugin stockable.php. (\plugins\vmcustom\stockable\stockable.php).

I am using the
Joomla 2.5.11
VM 2.020b
on a local xamp server.

Any suggestions on how to solve this bug ?

regards

Jörgen @ Kreativ Fotografi



Joomla 3.9.18
Virtuemart 3.4.x
Olympiantheme Hera (customized)
This reflects current status when viewing old post.

OpenGlobal

When you are looking at a product page that uses stockable, you are looking at the parent, but with some extra functionality to handle stock control of child products, so $this->product will always be the parent.

It can't be any other way because your PHP will not know which child is selected (it executes before anything is displayed). And it definitely won't be able to update the browser from the server side.

The only way to update the SKU on the screen would be to add some javascript to get it every time the options are changed.

OpenGlobal E-commerce

Jörgen

Thanks for the reply

OK, I can get this.

I use child products frequently in my store and I want to display the SKU, because it is sometimes easier to communicate with customers using the SKU rather than an long product description. Currently I use VM 1.1 but I am in the progress of migrating to 2.xx and I want to have done all the customization before I open the new 2.xx shop.

The price is modified when changing child product, then there must be some way to add a something to update the SKU at  the same time.
Do You have any suggestions in which file I should look and add code?

regards

Jörgen @ Kreativ Fotografi
Joomla 3.9.18
Virtuemart 3.4.x
Olympiantheme Hera (customized)
This reflects current status when viewing old post.

OpenGlobal

The file that you'll need to modify is:

/plugins/vmcustom/stockable/stockable.php

The product_sku is already retrieved from the database in getValideChild() so you should just need to modify plgVmOnDisplayProductVariantFE() to display it on the page.

OpenGlobal E-commerce

Jörgen

Thank You

Great I will have a check :)

regards

Jörgen @ Kreativ Fotografi
Joomla 3.9.18
Virtuemart 3.4.x
Olympiantheme Hera (customized)
This reflects current status when viewing old post.