order creation
This commit is contained in:
@@ -33,6 +33,7 @@ class OrderEvent extends ActionEvent
|
||||
protected $deliveryModule = null;
|
||||
protected $paymentModule = null;
|
||||
protected $postage = null;
|
||||
protected $ref = null;
|
||||
|
||||
/**
|
||||
* @param Order $order
|
||||
@@ -55,7 +56,7 @@ class OrderEvent extends ActionEvent
|
||||
*/
|
||||
public function setInvoiceAddress($address)
|
||||
{
|
||||
$this->deliveryAddress = $address;
|
||||
$this->invoiceAddress = $address;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -90,6 +91,14 @@ class OrderEvent extends ActionEvent
|
||||
$this->postage = $postage;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $ref
|
||||
*/
|
||||
public function setRef($ref)
|
||||
{
|
||||
$this->ref = $ref;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return null|Order
|
||||
*/
|
||||
@@ -137,4 +146,12 @@ class OrderEvent extends ActionEvent
|
||||
{
|
||||
return $this->postage;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return null|int
|
||||
*/
|
||||
public function getRef()
|
||||
{
|
||||
return $this->ref;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -215,9 +215,12 @@ final class TheliaEvents
|
||||
/**
|
||||
* Order linked event
|
||||
*/
|
||||
const ORDER_SET_BILLING_ADDRESS = "action.order.setBillingAddress";
|
||||
const ORDER_SET_DELIVERY_ADDRESS = "action.order.setDeliveryAddress";
|
||||
const ORDER_SET_DELIVERY_MODULE = "action.order.setDeliveryModule";
|
||||
const ORDER_SET_INVOICE_ADDRESS = "action.order.setInvoiceAddress";
|
||||
const ORDER_SET_PAYMENT_MODULE = "action.order.setPaymentModule";
|
||||
const ORDER_PAY = "action.order.pay";
|
||||
const ORDER_SET_REFERENCE = "action.order.setReference";
|
||||
|
||||
/**
|
||||
* Sent on image processing
|
||||
|
||||
@@ -65,6 +65,8 @@ abstract class BaseI18nLoop extends BaseLoop
|
||||
{
|
||||
/* manage translations */
|
||||
|
||||
$fr = $this->getForce_return();
|
||||
|
||||
return ModelCriteriaTools::getI18n(
|
||||
$this->getBackend_context(),
|
||||
$this->getLang(),
|
||||
|
||||
@@ -58,7 +58,19 @@ class Argument
|
||||
|
||||
public function setValue($value)
|
||||
{
|
||||
$this->value = $value === null ? null : (string) $value;
|
||||
$x = $value === null;
|
||||
|
||||
if($value === null) {
|
||||
$this->value = null;
|
||||
} else {
|
||||
if(false === $value) {
|
||||
/* (string) $value = "" */
|
||||
$this->value = 0;
|
||||
} else {
|
||||
$this->value = (string) $value;
|
||||
}
|
||||
}
|
||||
//$this->value = $value === null ? null : (string) $value;
|
||||
}
|
||||
|
||||
public static function createAnyTypeArgument($name, $default=null, $mandatory=false, $empty=true)
|
||||
|
||||
@@ -110,4 +110,13 @@ class Cart extends BaseLoop
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the event dispatcher,
|
||||
*
|
||||
* @return \Symfony\Component\EventDispatcher\EventDispatcher
|
||||
*/
|
||||
public function getDispatcher()
|
||||
{
|
||||
return $this->dispatcher;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24,6 +24,7 @@
|
||||
namespace Thelia\Core\Template\Smarty\Plugins;
|
||||
|
||||
use Propel\Runtime\ActiveQuery\ModelCriteria;
|
||||
use Symfony\Component\EventDispatcher\ContainerAwareEventDispatcher;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Thelia\Core\Template\Smarty\AbstractSmartyPlugin;
|
||||
use Thelia\Core\Security\SecurityContext;
|
||||
@@ -53,12 +54,14 @@ class DataAccessFunctions extends AbstractSmartyPlugin
|
||||
private $securityContext;
|
||||
protected $parserContext;
|
||||
protected $request;
|
||||
protected $dispatcher;
|
||||
|
||||
public function __construct(Request $request, SecurityContext $securityContext, ParserContext $parserContext)
|
||||
public function __construct(Request $request, SecurityContext $securityContext, ParserContext $parserContext, ContainerAwareEventDispatcher $dispatcher)
|
||||
{
|
||||
$this->securityContext = $securityContext;
|
||||
$this->parserContext = $parserContext;
|
||||
$this->request = $request;
|
||||
$this->dispatcher = $dispatcher;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -195,6 +198,12 @@ class DataAccessFunctions extends AbstractSmartyPlugin
|
||||
return $order->getPostage();
|
||||
case 'delivery_address':
|
||||
return $order->chosenDeliveryAddress;
|
||||
case 'invoice_address':
|
||||
return $order->chosenInvoiceAddress;
|
||||
case 'delivery_module':
|
||||
return $order->getDeliveryModuleId();
|
||||
case 'payment_module':
|
||||
return $order->getPaymentModuleId();
|
||||
}
|
||||
|
||||
throw new \InvalidArgumentException(sprintf("%s has no '%s' attribute", 'Order', $attribute));
|
||||
@@ -320,4 +329,14 @@ class DataAccessFunctions extends AbstractSmartyPlugin
|
||||
new SmartyPluginDescriptor('function', 'order', $this, 'orderDataAccess'),
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the event dispatcher,
|
||||
*
|
||||
* @return \Symfony\Component\EventDispatcher\EventDispatcher
|
||||
*/
|
||||
public function getDispatcher()
|
||||
{
|
||||
return $this->dispatcher;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user