From 3aba9f026bd783f49e8580d487a53fe87798854b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Gaillard?= Date: Mon, 25 Mar 2013 16:48:57 +0100 Subject: [PATCH] [-] BO: Fix #PSCFV-8422 it is now possible to manage minimal quantity even if stock management is disabled --- .../controllers/products/quantities.tpl | 387 +++++++++--------- controllers/admin/AdminProductsController.php | 4 - 2 files changed, 193 insertions(+), 198 deletions(-) diff --git a/admin-dev/themes/default/template/controllers/products/quantities.tpl b/admin-dev/themes/default/template/controllers/products/quantities.tpl index 61fa3241b..9236418a3 100644 --- a/admin-dev/themes/default/template/controllers/products/quantities.tpl +++ b/admin-dev/themes/default/template/controllers/products/quantities.tpl @@ -26,177 +26,174 @@ {if isset($product->id)}

{l s='Available quantities for sale'}

- {include file="controllers/products/multishop/check_fields.tpl" product_tab="Quantities"}
-
-

{l s='This interface allows you to manage available quantities for sale for products. It also allows you to manage product combinations in the current shop.'}

-

{l s='You can choose whether or not to use the advanced stock management system for this product.'}

-

{l s='You can manually specify the quantities for the product/each product combination, or you can choose to automatically determine these quantities based on your stock (if advanced stock management is activated).'}

-

{l s='In this case, quantities correspond to the real-stock quantities in the warehouses connected with the current shop, or current group of shops.'}

-
-

{l s='For packs: If it has products that use advanced stock management, you have to specify a common warehouse for these products in the pack.'}

-

{l s='Also, please note that when a product has combinations, its default combination will be used in stock movements.'}

-
-
-

{l s='Available quantities for sale'}

-
- {if $show_quantities == true} - - - + {if !$ps_stock_management} +
{l s='The stock management is disabled'}
+ {else} + {include file="controllers/products/multishop/check_fields.tpl" product_tab="Quantities"} +
+

{l s='This interface allows you to manage available quantities for sale for products. It also allows you to manage product combinations in the current shop.'}

+

{l s='You can choose whether or not to use the advanced stock management system for this product.'}

+

{l s='You can manually specify the quantities for the product/each product combination, or you can choose to automatically determine these quantities based on your stock (if advanced stock management is activated).'}

+

{l s='In this case, quantities correspond to the real-stock quantities in the warehouses connected with the current shop, or current group of shops.'}

+
+

{l s='For packs: If it has products that use advanced stock management, you have to specify a common warehouse for these products in the pack.'}

+

{l s='Also, please note that when a product has combinations, its default combination will be used in stock movements.'}

+
+
+ {if $show_quantities == true} + + + - - - is_virtual || $product->cache_is_pack}style="display:none;"{/if} class="stockForVirtualProduct"> - - - is_virtual || $product->cache_is_pack}style="display:none;"{/if} class="stockForVirtualProduct"> - - +
- advanced_stock_management == 1 && $stock_management_active == 1} - value="1" checked="checked" - {else} - value="0" - {/if} - {if $stock_management_active == 0 || $product->cache_is_pack} - disabled="disabled" - {/if} - type="checkbox" name="advanced_stock_management" class="advanced_stock_management" id="advanced_stock_management" /> - -

-
- depends_on_stock == 1 && $stock_management_active == 1} - checked="checked" - {/if} - {if $stock_management_active == 0 || $product->advanced_stock_management == 0 || $product->cache_is_pack} - disabled="disabled" - {/if} - type="radio" name="depends_on_stock" class="depends_on_stock" id="depends_on_stock_1" value="1"/> - -

-
+ + is_virtual || $product->cache_is_pack}style="display:none;"{/if} class="stockForVirtualProduct"> + + + is_virtual || $product->cache_is_pack}style="display:none;"{/if} class="stockForVirtualProduct"> + + - is_virtual || $product->cache_is_pack}style="display:none;"{/if} class="stockForVirtualProduct"> - - - {if isset($pack_quantity)} - - - - {/if} - - - - - + + +
+ advanced_stock_management == 1 && $stock_management_active == 1} + value="1" checked="checked" + {else} + value="0" + {/if} + {if $stock_management_active == 0 || $product->cache_is_pack} + disabled="disabled" + {/if} + type="checkbox" name="advanced_stock_management" class="advanced_stock_management" id="advanced_stock_management" /> + +

+
+ depends_on_stock == 1 && $stock_management_active == 1} + checked="checked" + {/if} + {if $stock_management_active == 0 || $product->advanced_stock_management == 0 || $product->cache_is_pack} + disabled="disabled" + {/if} + type="radio" name="depends_on_stock" class="depends_on_stock" id="depends_on_stock_1" value="1"/> + +

+
- depends_on_stock == 0 || $stock_management_active == 0} - checked="checked" - {/if} - type="radio" name="depends_on_stock" class="depends_on_stock" id="depends_on_stock_0" value="0"/> - -

-
-

{l s='When a product has combinations, quantities will be based on the default combination.'}

-

{l s='Given the quantities of the products in this pack, the maximum quantity should be:'} {$pack_quantity}

-
- - - - - - - - - - - - - {foreach from=$attributes item=attribute} - - - - - {/foreach} - -
{l s='Quantity'}{l s='Designation'}
- {$available_quantity[$attribute['id_product_attribute']]} - - {$product_designation[$attribute['id_product_attribute']]}
-
- - - - - is_virtual || $product->cache_is_pack}style="display:none;"{/if} class="stockForVirtualProduct"> + + + {if isset($pack_quantity)} + + + + {/if} + + + + + - - -
-
    -
  • - out_of_stock == 0} checked="checked" {/if} id="out_of_stock_1" type="radio" checked="checked" value="0" class="out_of_stock" name="out_of_stock"> - +
+ depends_on_stock == 0 || $stock_management_active == 0} + checked="checked" + {/if} + type="radio" name="depends_on_stock" class="depends_on_stock" id="depends_on_stock_0" value="0"/> + +

+
+

{l s='When a product has combinations, quantities will be based on the default combination.'}

+

{l s='Given the quantities of the products in this pack, the maximum quantity should be:'} {$pack_quantity}

+
+ + + + + + + + + + + + + {foreach from=$attributes item=attribute} + + + + + {/foreach} + +
{l s='Quantity'}{l s='Designation'}
+ {$available_quantity[$attribute['id_product_attribute']]} + + {$product_designation[$attribute['id_product_attribute']]}
+
+ + + + + - - -
+
    +
  • + out_of_stock == 0} checked="checked" {/if} id="out_of_stock_1" type="radio" checked="checked" value="0" class="out_of_stock" name="out_of_stock"> + +
  • +
  • + out_of_stock == 1} checked="checked" {/if} id="out_of_stock_2" type="radio" value="1" class="out_of_stock" name="out_of_stock"> +
  • - out_of_stock == 1} checked="checked" {/if} id="out_of_stock_2" type="radio" value="1" class="out_of_stock" name="out_of_stock"> - -
  • -
  • - out_of_stock == 2} checked="checked" {/if} id="out_of_stock_3" type="radio" value="2" class="out_of_stock" name="out_of_stock"> - -
  • -
-
-
- {else} -
-

{l s='It is not possible to manage quantities when:'}

-
    -
  • {l s='You are currently managing all of your shops.'}
  • -
  • {l s='You are currently managing a group of shops where quantities are not shared between every shop in this group.'}
  • -
  • {l s='You are currently managing a shop that is in a group where quantities are shared between every shop in this group.'}
  • -
-
+ out_of_stock == 2} checked="checked" {/if} id="out_of_stock_3" type="radio" value="2" class="out_of_stock" name="out_of_stock"> + + + +
+ + + + + {else} +
+

{l s='It is not possible to manage quantities when:'}

+ +
+ {/if} {/if}

{l s='Availability settings'}

- {if !$ps_stock_management} - - - - {/if} {if !$has_attribute} @@ -206,41 +203,43 @@ {/if} - - - - - - - - - {if !$countAttributes} + {if $ps_stock_management} - - + + + + + + {if !$countAttributes} + + + + + {/if} {/if}
{l s='The stock management is disabled'}
- {include file="controllers/products/multishop/checkbox.tpl" field="available_now" type="default" multilang="true"} - - - {include file="controllers/products/input_text_lang.tpl" - languages=$languages - input_value=$product->available_now - input_name='available_now'} - {l s='Forbidden characters:'} <>;=#{}  -
- {include file="controllers/products/multishop/checkbox.tpl" field="available_later" type="default" multilang="true"} - - - {include file="controllers/products/input_text_lang.tpl" - languages=$languages - input_value=$product->available_later - input_name='available_later'} - {l s='Forbidden characters:'} <>;=#{}  -
- -

{l s='The available date when this product is out of stock.'}

+
+ {include file="controllers/products/multishop/checkbox.tpl" field="available_now" type="default" multilang="true"} + + + {include file="controllers/products/input_text_lang.tpl" + languages=$languages + input_value=$product->available_now + input_name='available_now'} + {l s='Forbidden characters:'} <>;=#{}  +
+ {include file="controllers/products/multishop/checkbox.tpl" field="available_later" type="default" multilang="true"} + + + {include file="controllers/products/input_text_lang.tpl" + languages=$languages + input_value=$product->available_later + input_name='available_later'} + {l s='Forbidden characters:'} <>;=#{} 
+ +

{l s='The available date when this product is out of stock.'}

+
diff --git a/controllers/admin/AdminProductsController.php b/controllers/admin/AdminProductsController.php index b355d4d0b..46bb46c56 100644 --- a/controllers/admin/AdminProductsController.php +++ b/controllers/admin/AdminProductsController.php @@ -2206,10 +2206,6 @@ class AdminProductsControllerCore extends AdminController foreach ($this->available_tabs as $product_tab => $value) { - // if it's the quantities tab and stock management is disabled, continue - if ($stock_management_active == 0 && $product_tab == 'Quantities') - continue; - // if it's the warehouses tab and advanced stock management is disabled, continue if ($advanced_stock_management_active == 0 && $product_tab == 'Warehouses') continue;