GRXinside Posted August 6, 2018 Share Posted August 6, 2018 Hello, I currently have a code that shows the stock of the stores with their respective names. What I want to do is, instead of showing the name and the stock, show a custom image of the stock level of each store. For example, if there are more than 5 products in the central warehouse, I want to create an image with the name, "Central warehouse" and in the middle a green icon, indicating that there is stock, and in case there is no stock in that store mentioned, show the same but in red. Code ProductController.php /** STOCK WAREHOUSE */ $id_product = (int)Tools::getValue('id_product'); $warehouses = WarehouseCore::getWarehousesByProductId($id_product); foreach($warehouses as $qty) $warehouse_qty[]=ProductCore::getRealQuantity($id_product,'',$qty['id_warehouse']); $this->context->smarty->assign(array('warehouseName' => $warehouses)); $this->context->smarty->assign(array('warehouseQty' => $warehouse_qty)); Code Product.tpl {foreach from=$warehouseName item=warehouse key=k} {if $warehouseQty[$k] > 0} <P>{$warehouse['name']} ({$warehouseQty[$k]})</P> !!no show <!--<p><img src="Here show one image or another depending on the store name and its stock"> </p> {/if} {/foreach} Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now