Show Posts


Messages - otterslide

Pages: 1 [2]
16
Support / Re: Displaying in stock options on product listing
« on: October 20, 2014, 01:36:32 PM »
Thanks, That seems to work, and already filters out 0 quantity,

$this->model_catalog_product->getProductOptions($product['product_id']);

Would be nice if this was cached in the product, I think this will query for each product, correct?


Check the model for product


getProductOptions method will give you all details for options including the stock.

Look at 'quantity' for each option.

17
Support / Displaying in stock options on product listing
« on: October 20, 2014, 01:13:31 PM »
Hello,

I have some items that have multiple sizes and I need to display the sizes on the main product listing before people click the listing.
I managed to display options out of the $Product object and looping them, however it is getting even the options which have 0 quantity left in stock.
Does anyone know how to check if an Option is in stock for a particular product?.. or how to get the list of in-stock options in a better way?..

Or even what code I can take a look at that is doing this already.. it must be doing it on the product listing page somehow to get the dropdown list.

this is what I came up with:

/template/pages/product/product_listing.tpl

      $options = $product['options'];
      if($options != null) {
         foreach ($options as $option) {
            if($option['option_value'] != null) {
            
               foreach ($option['option_value'] as $option_value) {
               $option_text .=  $option_value['name'];
               $option_text .= "<br/>";
               }
            }
         }
      }

Thanks!

Pages: 1 [2]

Powered by SMFPacks Social Login Mod