Jump to content

class calculating volume of packages


Recommended Posts

Hello, I am looking for a solution to my problem, I need to know what will be the volume of parcels ordered products.

 

With the weight of the class discovered totalgetweight

but I can not find anywhere how to display the pack volume.

 

volume I have to then be used to calculate the cost of transport in another module.

Link to comment
Share on other sites

Hi I have code in tpl 

{$db = Db::getInstance()}
                
                {$flag = 0}
                {foreach $products as $product}
                    {$flag = $flag + 1}
                    {assign var='productId' value=$product.id_product}

                    {*Height*}
                    {$sql = "SELECT height FROM ps_product WHERE id_product = $productId"}
                    {assign var='height' value=$db->getValue($sql)}
                    {*/Height*}
                    
                    {*Width*}
                    {$sql = "SELECT width FROM ps_product WHERE id_product = $productId"}
                    {assign var='width' value=$db->getValue($sql)}
                    {*/Width*}
                    
                    {*DEPTH*}
                    {$sql = "SELECT depth FROM ps_product WHERE id_product = $productId"}
                    {assign var='depth' value=$db->getValue($sql)}
                    {*/DEPTH*}
                    
                    {assign var='quantity' value=$product.cart_quantity-$quantityDisplayed}
                    {assign var='capacity' value=$height*$width*$depth}
                    
                    {$Arrayquantity.$flag = $quantity}
                    {$ArrayCapacity.$flag = $capacity}
                    {$weight = $cart->getTotalWeight()|escape:'htmlall':'UTF-8'|number_format:2}
                {/foreach}

                {$capacity = 0}
                {foreach $ArrayCapacity as $key => $value}
                    {$capacity = $capacity + $value*$Arrayquantity[$key]/1000000}
                {/foreach}

how translate to php?

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...