Post by Teyno » Tue Apr 03, 2012 6:11 pm

Good day,

I have managed to create a field in the options list, which allows me to enter a SKU per option, I have created a field 'option_sku' in the database table product_option_value. So far so good.

Now I would like to access this SKU in the product page, Cart, Invoice etc.

I have added the following line to the model/product.php (after line 334)

Code: Select all

'option_sku'              => $product_option_value['option_sku']
So I suppose the value is passed to the array

Since I am not really a PHP programmer this is a far as I could get. How can I get the option_sku accessable in my template files?

Thanks.

--edit--
Ok so I figured out the option_sku has to be in somewhere like $product[$option[$option_value['option_sku']]], but this isn't working in my templates

--edit 2--
So the templates get their values from model/checkout/cart.php, in this file I added some code after line 214

Code: Select all

'option_sku' => $value['option_sku']
In my template I can use

Code: Select all

<?php echo $option['option_sku']; ?>
Now the only thing that goes wrong is that I dont get the correct SKU's, instead it's giving me the first number of the option value (20 liter = 2, 60 liter = 6 etc).
If I manually change $value['option_sku'] to something like 12345, then 12345 is displayed in the cart.

Any help greatly appreciated.

New member

Posts

Joined
Tue Dec 06, 2011 5:37 pm

Post by Teyno » Tue Apr 03, 2012 10:04 pm

It seems I can't get the option_sku from the model to the controller, no matter what I try. Anyone able to tell me how I get this value from model\catalog\product.php to controller\checkout\cart.php?

Forgot to mention I am on OC 1.5.2.1

New member

Posts

Joined
Tue Dec 06, 2011 5:37 pm

Post by Qphoria » Wed Apr 04, 2012 9:11 am

It can be tricky because you have to pass that value all the way from the product to the cart, to checkout, to the order.
There are mods that already offer option sku and a few other features to boot like this one:
Options Boost

This gives each option a sku (and image and description) and offers the option of swapping the image when the option is changed. It maintains the sku and everything all the way through to the order details so you can see them in the admin order view and even the invoice

Image


User avatar
Administrator

Posts

Joined
Tue Jul 22, 2008 3:02 am

Post by Teyno » Wed Apr 04, 2012 3:44 pm

Qphoria wrote:It can be tricky because you have to pass that value all the way from the product to the cart, to checkout, to the order.
There are mods that already offer option sku and a few other features to boot like this one:
Options Boost

This gives each option a sku (and image and description) and offers the option of swapping the image when the option is changed. It maintains the sku and everything all the way through to the order details so you can see them in the admin order view and even the invoice
I have seen that extension and it is exactly what I need, the only thing is that it cannot be combined with your Multiple Option Qty. I don't really need the image to change on select. Here's my situation;

I sell engine oils, let's say I have the 15W-40, which comes in packages of 1, 5, 20, 60 and 208 liter. Every package has its own SKU and image, but I also want people who need like 7 liters, to be able to put 2x 1 liter and 1x 5 liter in their cart, without having to click 5 or 6 times.

I would gladly pay extra $ for a solution for this.

New member

Posts

Joined
Tue Dec 06, 2011 5:37 pm
Who is online

Users browsing this forum: Amazon [Bot], Google [Bot] and 72 guests