Jump to content

Edit History

GFX_dev

GFX_dev

Thanks, that's an excellent idea. I noticed the variable is working in the product cart, so I investigated and I THINK it is rendered by Cart.php Line 4101

/**
     * Check if product quantities in Cart are available.
     *
     * @param bool $returnProductOnFailure Return the first found product with not enough quantity
     *
     * @return bool|array If all products are in stock: true; if not: either false or an array
     *                    containing the first found product which is not in stock in the
     *                    requested amount
     */

//snip///

$product['stock_quantity'] = StockManager::getStockByCarrier(
                    (int) $product['id_product'],
                    (int) $product['id_product_attribute'],
                    $delivery
                );
//snip//

 

I am struggling to continue. How would I re-assign this PHP to be used on the product page, modules which are displaying products (e.g. new arrivals) and the product-overview (grid page)?

For the later steps, I think you mean I should remove (comment-out) the $product.quantity label which renders the "Out of Stock" warning, and have it replaced with a tpl hook? In this custom tpl hook I will create a check with this pseudo-code?
 

{if $product.stock_quantity = 0 && $product.stock = 0}
//Truely out of stock
//Original code with label product out of stock
{elseif $product.stock_quantity = 1 && $product.stock = 0}
// The product is in the customers cart; alert customer to check cart;
<p>Please <a href="/cart">check cart</a></p> (or something like this)
{/if}

Thanks for the input!

GFX_dev

GFX_dev

Thanks, that's an excellent idea. I noticed the variable is working in the product cart, so I investigated and I THINK it is rendered by Cart.php Line 4101

 $product['stock_quantity'] = StockManager::getStockByCarrier(
                    (int) $product['id_product'],
                    (int) $product['id_product_attribute'],
                    $delivery
                );

 

I am struggling to continue. How would I re-assign this PHP to be used on the product page, modules which are displaying products (e.g. new arrivals) and the product-overview (grid page)?

For the later steps, I think you mean I should remove (comment-out) the $product.quantity label which renders the "Out of Stock" warning, and have it replaced with a tpl hook? In this custom tpl hook I will create a check with this pseudo-code?
 

{if $product.stock_quantity =< 0 && $product.stock =< 0}
//Truely out of stock
//Original code with label product out of stock
{elseif $product.stock_quantity > 0 && $product.stock =< 0}
// The product is in the customers cart; alert customer to check cart;
<p>Please <a href="/cart">check cart</a></p> (or something like this)
{/if}

Thanks for the input!

×
×
  • Create New...