[-] BO: don't display stock available if stock management is disabled #PSCFV-6029
This commit is contained in:
@@ -45,8 +45,8 @@
|
||||
</td>
|
||||
<td align="center" class="productQuantity">{$product['customizationQuantityTotal']}</td>
|
||||
{if ($order->hasBeenPaid())}<td align="center" class="productQuantity">{$product['customizationQuantityRefunded']}</td>{/if}
|
||||
{if ($order->hasBeenDelivered())}<td align="center" class="productQuantity">{$product['customizationQuantityReturned']}</td>{/if}
|
||||
<td align="center" class=""> - </td>
|
||||
{if ($order->hasBeenDelivered() || $order->hasProductReturned())}<td align="center" class="productQuantity">{$product['customizationQuantityReturned']}</td>{/if}
|
||||
{if $stock_management}<td align="center" class=""> - </td>{/if}
|
||||
<td align="center" class="total_product">
|
||||
{if ($order->getTaxCalculationMethod() == $smarty.const.PS_TAX_EXC)}
|
||||
{displayPrice price=Tools::ps_round($product['product_price'] * $product['customizationQuantityTotal'], 2) currency=$currency->id}
|
||||
|
||||
@@ -88,7 +88,7 @@
|
||||
{/if}
|
||||
</td>
|
||||
{/if}
|
||||
<td align="center" class="productQuantity product_stock">{$product['current_stock']}</td>
|
||||
{if $stock_management}<td align="center" class="productQuantity product_stock">{$product['current_stock']}</td>{/if}
|
||||
<td align="center" class="total_product">
|
||||
{displayPrice price=(Tools::ps_round($product_price, 2) * ($product['product_quantity'] - $product['customizationQuantityTotal'])) currency=$currency->id}
|
||||
</td>
|
||||
|
||||
@@ -39,6 +39,7 @@
|
||||
var priceDisplayPrecision = 2;
|
||||
var use_taxes = {if $order->getTaxCalculationMethod() == $smarty.const.PS_TAX_INC}true{else}false{/if};
|
||||
var token = "{$smarty.get.token|escape:'htmlall':'UTF-8'}";
|
||||
var stock_management = {$stock_management|intval};
|
||||
|
||||
var txt_add_product_stock_issue = "{l s='You want to add more product than are available in stock, are you sure you want to add this quantity?' js=1}";
|
||||
var txt_add_product_new_invoice = "{l s='Are you sure you want to create a new invoice?' js=1}";
|
||||
@@ -594,7 +595,7 @@
|
||||
<th style="width: 4%; text-align: center">{l s='Qty'}</th>
|
||||
{if ($order->hasBeenPaid())}<th style="width: 3%; text-align: center">{l s='Refunded'}</th>{/if}
|
||||
{if ($order->hasBeenDelivered() || $order->hasProductReturned())}<th style="width: 3%; text-align: center">{l s='Returned'}</th>{/if}
|
||||
<th style="width: 10%; text-align: center">{l s='Available quantity'}</th>
|
||||
{if $stock_management}<th style="width: 10%; text-align: center">{l s='Available quantity'}</th>{/if}
|
||||
<th style="width: 10%; text-align: center">{l s='Total'} <sup>*</sup></th>
|
||||
<th colspan="2" style="display: none;" class="add_product_fields"> </th>
|
||||
<th colspan="2" style="display: none;" class="edit_product_fields"> </th>
|
||||
|
||||
@@ -1122,8 +1122,11 @@ class AdminControllerCore extends Controller
|
||||
}
|
||||
public function display()
|
||||
{
|
||||
$this->context->smarty->assign('display_header', $this->display_header);
|
||||
$this->context->smarty->assign('display_footer', $this->display_footer);
|
||||
$this->context->smarty->assign(array(
|
||||
'display_header' => $this->display_header,
|
||||
'display_footer' => $this->display_footer,
|
||||
)
|
||||
);
|
||||
|
||||
// Use page title from meta_title if it has been set else from the breadcrumbs array
|
||||
if (!$this->meta_title)
|
||||
@@ -1702,6 +1705,7 @@ class AdminControllerCore extends Controller
|
||||
'table' => $this->table,
|
||||
'current' => self::$currentIndex,
|
||||
'token' => $this->token,
|
||||
'stock_management' => (int)Configuration::get('PS_STOCK_MANAGEMENT')
|
||||
));
|
||||
|
||||
if ($this->display_header)
|
||||
|
||||
+20
-15
@@ -284,7 +284,8 @@ function closeAddProduct()
|
||||
$('#add_product_product_quantity').val('1');
|
||||
$('#add_product_product_attribute_id option').remove();
|
||||
$('#add_product_product_attribute_area').hide();
|
||||
$('#add_product_product_stock').html('0');
|
||||
if (stock_management)
|
||||
$('#add_product_product_stock').html('0');
|
||||
current_product = null;
|
||||
}
|
||||
|
||||
@@ -356,7 +357,8 @@ function init()
|
||||
$('#add_product_product_price_tax_incl').val(data.price_tax_incl);
|
||||
$('#add_product_product_price_tax_excl').val(data.price_tax_excl);
|
||||
addProductRefreshTotal();
|
||||
$('#add_product_product_stock').html(data.stock[0]);
|
||||
if (stock_management)
|
||||
$('#add_product_product_stock').html(data.stock[0]);
|
||||
|
||||
if (current_product.combinations.length !== 0)
|
||||
{
|
||||
@@ -367,7 +369,8 @@ function init()
|
||||
$('select#add_product_product_attribute_id').append('<option value="'+this.id_product_attribute+'"'+(this.default_on == 1 ? ' selected="selected"' : '')+'>'+this.attributes+'</option>');
|
||||
if (this.default_on == 1)
|
||||
{
|
||||
$('#add_product_product_stock').html(this.qty_in_stock);
|
||||
if (stock_management)
|
||||
$('#add_product_product_stock').html(this.qty_in_stock);
|
||||
defaultAttribute = this.id_product_attribute;
|
||||
}
|
||||
});
|
||||
@@ -396,24 +399,26 @@ function init()
|
||||
populateWarehouseList(current_product.warehouse_list[$(this).val()]);
|
||||
|
||||
addProductRefreshTotal();
|
||||
|
||||
$('#add_product_product_stock').html(current_product.combinations[$(this).val()].qty_in_stock);
|
||||
if (stock_management)
|
||||
$('#add_product_product_stock').html(current_product.combinations[$(this).val()].qty_in_stock);
|
||||
});
|
||||
|
||||
$('input#add_product_product_quantity').unbind('keyup');
|
||||
$('input#add_product_product_quantity').keyup(function() {
|
||||
var quantity = parseInt($(this).val());
|
||||
if (quantity < 1 || isNaN(quantity))
|
||||
quantity = 1;
|
||||
var stock_available = parseInt($('#add_product_product_stock').html());
|
||||
if (stock_management)
|
||||
{
|
||||
var quantity = parseInt($(this).val());
|
||||
if (quantity < 1 || isNaN(quantity))
|
||||
quantity = 1;
|
||||
var stock_available = parseInt($('#add_product_product_stock').html());
|
||||
// stock status update
|
||||
if (quantity > stock_available)
|
||||
$('#add_product_product_stock').css('font-weight', 'bold').css('color', 'red').css('font-size', '1.2em');
|
||||
else
|
||||
$('#add_product_product_stock').css('font-weight', 'normal').css('color', 'black').css('font-size', '1em');
|
||||
}
|
||||
// total update
|
||||
addProductRefreshTotal();
|
||||
|
||||
// stock status update
|
||||
if (quantity > stock_available)
|
||||
$('#add_product_product_stock').css('font-weight', 'bold').css('color', 'red').css('font-size', '1.2em');
|
||||
else
|
||||
$('#add_product_product_stock').css('font-weight', 'normal').css('color', 'black').css('font-size', '1em');
|
||||
});
|
||||
|
||||
$('#submitAddProduct').unbind('click');
|
||||
|
||||
Reference in New Issue
Block a user