Jump to content

Combinations when one combo is out of stock


Recommended Posts

I have a problem with default selection of combinations.

 

When you create combinations with attributes (such as an item that comes in three different types of wood and the user selects the desired one through the attribute dropdown), you specify one combination as being the default.

 

When the customer enters the product page and the default combination is out of stock, the page says "out of stock." When the default combination is out of stock, I'd prefer that PrestaShop selected some other combination to show as the selected item, preferably the one with the greatest stock. I'd prefer that "out of stock" not be shown unless all combinations were out of stock.

 

Is there any way to do this?

Link to comment
Share on other sites

  • 3 months later...

I have tha same problem. I have an upgrade instalations that come from 1.3 but i'm now in the 1.4.8 and find solutions that say this is fixed in the 1.4, but its not real. The core still count like out of stock if the default combinations its in 0. There are any solution for this.

 

I found a topic that said: set the ps_product table cache-atribute field to 0, but this not work, and no more solutions in the forums

 

Any solution please

Link to comment
Share on other sites

  • 4 weeks later...

same problem with me,

some said in version 1.4.1 problem already fixed, but i install 1.5.2 seems the problem still occur.

 

i see the code in product list.tpl :

{if isset($product.available_for_order) && $product.available_for_order && !isset($restricted_country_mode)}<span class="availability">{if ($product.allow_oosp || $product.quantity > 0)}{l s='Available'}{elseif (isset($product.quantity_all_versions) && $product.quantity_all_versions > 0)}{l s='Product available with different options'}{else}{l s='Out of stock'}{/if}</span>{/if}

 

but 'Product available with different options' didnt work, in front office always say 'Out of Stock'

 

really2 need someone mastering help for this

  • Like 1
Link to comment
Share on other sites

  • 8 months later...

Don't know about other versions, but in 1.5.4.1 it seems to be catered for. With the default combo out of stock, but stock available in on or more of the other combos, you get the following message next to 'Availability' on the product page:

 

This product is no longer in stock with those attributes but is available with others.

 

This will be displayed for any combo that's out of stock.

Link to comment
Share on other sites

I found the solution by myself

here is the script !

 

			{if isset($product.available_for_order) && $product.available_for_order && !isset($restricted_country_mode)}

			{if $product.quantity > 0}
			<span class="availability">{l s='Available'}</span>

			{elseif $product.allow_oosp == 0}
			<span class="outstock">{l s='Out of stock'}</span>

			{elseif (isset($product.quantity_all_versions) && $product.quantity_all_versions > 0)}
			<span class="differentoptions">{l s='Product available with different options'}</span>

			{else}
			<span class="soon">{l s='oospAvailable'}</span>
			{/if}

			{/if}

Edited by zoomtronic (see edit history)
Link to comment
Share on other sites

You can also use this module http://www.prestashop.com/forums/index.php?/topic/38061-module-attribute-wizard-customize-prestshop-attributes-control-the-group-and-item-order-add-group-images-descriptions-and-more/

 

It can automatically hide / disable unavailable options.

 

If the default combination is not available, it will automatically select another one.

Link to comment
Share on other sites

  • 8 months later...
  • 2 years later...

Since this is a feature that should have been implemented in the PS core functionalities and for over 2 years NO solutions were given except 2 paid modules, I am going to SPAM all the threads that address this matter.
I am sorry but it doesn't seem fair at all that such an important base feature is made available via paid module when it should have been rolled out in a PS update long time ago  :( 
 

I've seen so many PS stores losing customers because they see an Out of Stock message on a product that actually HAS stock on other combinations. It's already beyond ridiculous, this silence of the PS staff.
 

This a call of desperation to the PS staff, of a lot of PS users, not just mine.

Let the solution reveal itself at last!

#MegaBump

  • Like 3
Link to comment
Share on other sites

  • 3 months later...

Since this is a feature that should have been implemented in the PS core functionalities and for over 2 years NO solutions were given except 2 paid modules, I am going to SPAM all the threads that address this matter.

I am sorry but it doesn't seem fair at all that such an important base feature is made available via paid module when it should have been rolled out in a PS update long time ago  :( 

 

I've seen so many PS stores losing customers because they see an Out of Stock message on a product that actually HAS stock on other combinations. It's already beyond ridiculous, this silence of the PS staff.

 

This a call of desperation to the PS staff, of a lot of PS users, not just mine.

Let the solution reveal itself at last!

 

#MegaBump

 

I agree, bump again

Edited by j.kaspar (see edit history)
Link to comment
Share on other sites

Since I am not good in php and don't know much about architecture of Prestashop, solution I came up with, is based on SQL. Here is a procedure, that could be called on regular basis, to find a combination of a product, that has default combination with quantity < 1 and that has combination with quantity > 0 available, and set it as default. Tested on 1.6.1.13

delimiter //
CREATE PROCEDURE setAvailableDefaultCombinations()
BEGIN
  
  DECLARE done INT default false;
  DECLARE attribute_id INT;
  DECLARE product_id INT;
  DECLARE cur CURSOR FOR
    SELECT pa.id_product FROM ps_product_attribute pa
	 JOIN ps_product p ON p.id_product = pa.id_product
     JOIN ps_stock_available sa ON p.id_product = sa.id_product AND pa.id_product_attribute = sa.id_product_attribute
	WHERE
	 pa.default_on = 1 AND
	 (pa.quantity < 1 OR sa.quantity < 1) AND
	 p.active = 1 AND
	 pa.id_product IN (SELECT id_product FROM ps_stock_available WHERE quantity > 0);
 
   OPEN cur;
   
   read_loop: LOOP
	 SET done = FALSE;
     FETCH cur INTO product_id;
     IF done THEN
		SELECT 1;
		LEAVE read_loop;
	 END IF;
     
     SET attribute_id = (
          SELECT id_product_attribute
           FROM ps_stock_available
            WHERE id_product = product_id
             AND quantity > 0
             AND id_product_attribute <> 0
		   order by quantity desc, id_product_attribute
           limit 1
		);
        
	UPDATE ps_product_attribute a
	  JOIN ps_product_attribute_shop pas ON (pas.id_product_attribute = a.id_product_attribute AND pas.id_shop = 1)
	 SET a.default_on = NULL, pas.default_on = NULL
	  WHERE a.`id_product` = product_id;

	UPDATE ps_product_attribute a
	  JOIN ps_product_attribute_shop pas ON (pas.id_product_attribute = a.id_product_attribute AND pas.id_shop = 1)
     SET a.default_on = '1', pas.default_on = '1'
      WHERE a.`id_product` = product_id AND a.`id_product_attribute` = attribute_id;

    UPDATE ps_product a
	  JOIN ps_product_shop ps ON (ps.id_product = a.id_product AND ps.id_shop = 1)
     SET a.cache_default_attribute = attribute_id, ps.cache_default_attribute = attribute_id
	WHERE a.`id_product` = product_id; 
     
	END LOOP;     
 
 
 END//

Edited by j.kaspar (see edit history)
Link to comment
Share on other sites

×
×
  • Create New...