Merge pull request #22940 from scmmishra/fix-item-configure-13-beta

This commit is contained in:
Shivam Mishra 2020-08-06 13:20:11 +00:00 committed by GitHub
commit 5994600717
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 7 deletions

View File

@ -239,7 +239,8 @@ def get_next_attribute_and_values(item_code, selected_attributes):
if exact_match: if exact_match:
data = get_product_info_for_website(exact_match[0]) data = get_product_info_for_website(exact_match[0])
product_info = data.product_info product_info = data.product_info
product_info["allow_items_not_in_stock"] = cint(data.cart_settings.allow_items_not_in_stock) if product_info:
product_info["allow_items_not_in_stock"] = cint(data.cart_settings.allow_items_not_in_stock)
if not data.cart_settings.show_price: if not data.cart_settings.show_price:
product_info = None product_info = None
else: else:

View File

@ -193,17 +193,14 @@ class ItemConfigure {
filtered_items_count === 1 ? filtered_items_count === 1 ?
filtered_items[0] : ''; filtered_items[0] : '';
// Allow Add to Cart if adding out of stock items enabled in Shopping Cart else check stock.
const in_stock = product_info.allow_items_not_in_stock ? 1 : product_info.in_stock;
const add_to_cart = `<a href data-action="btn_add_to_cart" data-item-code="${one_item}">${__('Add to cart')}</a>`;
const product_action = in_stock ? add_to_cart : `<a style="color:#74808b;">${__('Not in Stock')}</a>`;
const item_add_to_cart = one_item ? ` const item_add_to_cart = one_item ? `
<div class="alert alert-success d-flex justify-content-between align-items-center" role="alert"> <div class="alert alert-success d-flex justify-content-between align-items-center" role="alert">
<div> <div>
<div>${one_item} ${product_info && product_info.price ? '(' + product_info.price.formatted_price_sales_uom + ')' : ''}</div> <div>${one_item} ${product_info && product_info.price ? '(' + product_info.price.formatted_price_sales_uom + ')' : ''}</div>
</div> </div>
${product_action} <a href data-action="btn_add_to_cart" data-item-code="${one_item}">
${__('Add to cart')}
</a>
</div> </div>
`: ''; `: '';