Impemented combination creation

This commit is contained in:
franck
2013-09-23 17:03:36 +02:00
parent e7974a21a7
commit 645ff15fcf
10 changed files with 373 additions and 83 deletions

View File

@@ -0,0 +1,63 @@
<?php
/*************************************************************************************/
/* */
/* Thelia */
/* */
/* Copyright (c) OpenStudio */
/* email : info@thelia.net */
/* web : http://www.thelia.net */
/* */
/* This program is free software; you can redistribute it and/or modify */
/* it under the terms of the GNU General Public License as published by */
/* the Free Software Foundation; either version 3 of the License */
/* */
/* This program is distributed in the hope that it will be useful, */
/* but WITHOUT ANY WARRANTY; without even the implied warranty of */
/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */
/* GNU General Public License for more details. */
/* */
/* You should have received a copy of the GNU General Public License */
/* along with this program. If not, see <http://www.gnu.org/licenses/>. */
/* */
/*************************************************************************************/
namespace Thelia\Core\Event;
use Thelia\Model\Product;
class ProductCreateCombinationEvent extends ProductEvent
{
protected $use_default_pricing;
protected $attribute_av_list;
public function __construct(Product $product, $use_default_pricing, $attribute_av_list)
{
parent::__construct($product);
$this->use_default_pricing = $use_default_pricing;
$this->attribute_av_list = $attribute_av_list;
}
public function getUseDefaultPricing()
{
return $this->use_default_pricing;
}
public function setUseDefaultPricing($use_default_pricing)
{
$this->use_default_pricing = $use_default_pricing;
return $this;
}
public function getAttributeAvList()
{
return $this->attribute_av_list;
}
public function setAttributeAvList($attribute_av_list)
{
$this->attribute_av_list = $attribute_av_list;
return $this;
}
}

View File

@@ -188,7 +188,10 @@ final class TheliaEvents
const PRODUCT_REMOVE_CONTENT = "action.productRemoveContent";
const PRODUCT_UPDATE_CONTENT_POSITION = "action.updateProductContentPosition";
const PRODUCT_SET_TEMPLATE = "action.productSetTemplate";
const PRODUCT_ADD_COMBINATION = "action.productAddCombination";
const PRODUCT_DELETE_COMBINATION = "action.productDeleteCombination";
const PRODUCT_SET_TEMPLATE = "action.productSetTemplate";
const PRODUCT_ADD_ACCESSORY = "action.productAddProductAccessory";
const PRODUCT_REMOVE_ACCESSORY = "action.productRemoveProductAccessory";

View File

@@ -170,17 +170,18 @@ class ProductSaleElements extends BaseLoop
$taxedPromoPrice = null;
}
$loopResultRow->set("ID", $PSEValue->getId())
->set("QUANTITY", $PSEValue->getQuantity())
->set("IS_PROMO", $PSEValue->getPromo() === 1 ? 1 : 0)
->set("IS_NEW", $PSEValue->getNewness() === 1 ? 1 : 0)
->set("WEIGHT", $PSEValue->getWeight())
->set("PRICE", $price)
->set("PRICE_TAX", $taxedPrice - $price)
->set("TAXED_PRICE", $taxedPrice)
->set("PROMO_PRICE", $promoPrice)
->set("PROMO_PRICE_TAX", $taxedPromoPrice - $promoPrice)
->set("TAXED_PROMO_PRICE", $taxedPromoPrice);
$loopResultRow
->set("ID" , $PSEValue->getId())
->set("QUANTITY" , $PSEValue->getQuantity())
->set("IS_PROMO" , $PSEValue->getPromo() === 1 ? 1 : 0)
->set("IS_NEW" , $PSEValue->getNewness() === 1 ? 1 : 0)
->set("WEIGHT" , $PSEValue->getWeight())
->set("PRICE" , $price)
->set("PRICE_TAX" , $taxedPrice - $price)
->set("TAXED_PRICE" , $taxedPrice)
->set("PROMO_PRICE" , $promoPrice)
->set("PROMO_PRICE_TAX" , $taxedPromoPrice - $promoPrice)
->set("TAXED_PROMO_PRICE" , $taxedPromoPrice);
$loopResult->addRow($loopResultRow);
}