Problems, need help? Have a tip or advice? Post it here.
4 posts Page 1 of 1
I have been trying to figure out a simple way of managing product stocks while also allowing the variant option.

Let's say we have the dimensions option added:
Code: Select all
Dimensions[XXS | XS | S | M | L | XL | XXL]**

...can this be easily changed to something like:
Code: Select all
Dimensions[!XXS | !XS | S | M | L | !XL | XXL]**

...Where you add a ! before all the options that are not in stock?

And then use this somehow inside the <cms:pp_product_options > to add a not-in-stock class to the label of that size?

This can further be used in the front end to display messages when selecting between sizes or hide the buy button and display a form so you can get announced when it comes back in stock.
Hi Alin,

Seems to be a plausible way of handling the use-case.
Will require making changes to the core code though which, I am afraid, I am not in a position to undertake at the moment.
KK wrote: Hi Alin,

Seems to be a plausible way of handling the use-case.

It's fine, I kinda figured it out even thought I am not a php guy :D

Code: Select all
if( $opt['modifier']=='*' || $opt['modifier']=='**' ){ // radio buttons ('**' specifies all buttons in the same row)
                                if( $opt['modifier']=='*' ) $html .= $sep;
                        if (strpos($str_option, '!') !== false) {
                           $str_option = preg_replace('/^!/', '', $str_option);
                           $html .= '<label class="radio-label not-in-stock">';
                        } else {
                                $html .= '<label class="radio-label">';
                                $html .= '<input type="radio" name="os'.$y.'" value="'.$x.'"';
                                if( $x==0 ) $html .= ' checked="true"';
                                $html .= '>'.$str_option;
                                $html .= '</label>';
Great :)
4 posts Page 1 of 1

Who is online

In total there are 5 users online :: 0 registered, 0 hidden and 5 guests
(based on users active over the past 5 minutes)

Users browsing this forum: No registered users and 5 guests