down vote favorite


What i want to do

please visit on this link and check price table for product where buyer can order product vai cartons type or containers type.

http://xpertslogic.net/projects/fola...all-panel.html

Your can order only cartons or containers at a time

what i have done

i have made all those prodct details through custom attributes to show on table . i have added jquery to price total according to select on quantity box .

i override magento code for custom price total in abstract.php

public function calcRowTotal()
{



$product = $this->getProduct();
$product->load($product->getId());


$QuantityPerCarton_get = $product->getQuantityPerCarton();
if(!empty($QuantityPerCarton_get)) {
$QuantityPerCarton = $QuantityPerCarton_get;
}
else {
$QuantityPerCarton =1;
}

$qty = $this->getTotalQty();
if ($qty <= 3)
{
$price = $product->getPricePerCorton();
}
elseif(3 < $qty && $qty >= 5)
{
$price = $product->getPricePerCortonSecond();
}
elseif(5 < $qty ) {
$price = $product->getPricePerCortonThree();
}
else {
$price = $this->getStore()->roundPrice($this->getCalculationPriceOriginal());
}

// Round unit price before multiplying to prevent losing 1 cent on subtotal
$total = $qty* $price * $QuantityPerCarton ;
$baseTotal = $qty* $price * $QuantityPerCarton ;

$this->setRowTotal($this->getStore()->roundPrice($total));
$this->setBaseRowTotal($this->getStore()->roundPrice($baseTotal));
return $this;





}

bcoz of this code order product by cartons part is working fine.

what i want to do now

i make a checkbox on product table , if buyer select it than carton part will hide and containers part will show to buyer.

buyer will enter Number of containers for both 20 and 40 foot and you can see jquery is totaling price on change of field .

but i have done code in abstract file for also get event is checkbox is select or not. if checkbox is not select price total for carton else price total for containers

but price total for containers it not working

here is final code for abstract.php

public function calcRowTotal()
{



$product = $this->getProduct();
$product->load($product->getId());

Mage::app()->getRequest()->getPost();
$checkebox = Mage::app()->getRequest()->getParam('input3');

if(empty($checkebox))
{

$QuantityPerCarton_get = $product->getQuantityPerCarton();
if(!empty($QuantityPerCarton_get)) {
$QuantityPerCarton = $QuantityPerCarton_get;
}
else {
$QuantityPerCarton =1;
}

$qty = $this->getTotalQty();
if ($qty <= 3)
{
$price = $product->getPricePerCorton();
}
elseif(3 < $qty && $qty >= 5)
{
$price = $product->getPricePerCortonSecond();
}
elseif(5 < $qty ) {
$price = $product->getPricePerCortonThree();
}
else {
$price = $this->getStore()->roundPrice($this->getCalculationPriceOriginal());
}

// Round unit price before multiplying to prevent losing 1 cent on subtotal
$total = $qty* $price * $QuantityPerCarton ;
$baseTotal = $qty* $price * $QuantityPerCarton ;

$this->setRowTotal($this->getStore()->roundPrice($total));
$this->setBaseRowTotal($this->getStore()->roundPrice($baseTotal));
return $this;


}

else {

$Product_id = $product->getId();

Mage::app()->getRequest()->getPost();
$qty_contw = Mage::app()->getRequest()->getParam('qty_contw['.$Product_id.']');
$qty_confr = Mage::app()->getRequest()->getParam('qty_confr['.$Product_id.']');

$TwentyContainerLoadPrice = $product->getTwentyContainerLoadPrice();
$FortyContainerLoadPrice = $product->getFortyContainerLoadPrice();
$TwentyContainerLoad = $product->getCartonsTwentyContainerLoad();
$FortyContainerLoad = $product->getCartonsFortyContainerLoad();
$total2 = $TwentyContainerLoadPrice *$TwentyContainerLoad;
$total4 = $FortyContainerLoadPrice * $FortyContainerLoad;

$subtoal_c = $total2 + $total4;


// Round unit price before multiplying to prevent losing 1 cent on subtotal
$total = $subtoal_c;
$baseTotal = $subtoal_c;

$this->setRowTotal($this->getStore()->roundPrice($total));
$this->setBaseRowTotal($this->getStore()->roundPrice($baseTotal));
return $this;

}

}

what is problem

my price total for containers is not working because magento is taking carton quantity by default for call price functions.

Help for what

i want to set numbers of 20 foot containers and 40 containers as quantity if checkbox is select

please help me where to code or override any functions

thank you in advance

View more threads in the same category: