Re: Extend Order and add a new Field to JQadm
Posted: 05 Jan 2018, 15:49
i understand....
...all this method are needed in the own Itemclass that the basket works....
(all methods who something do with the private property $locale or $price)
hope you can maybe specially make an documentaion for this kind of Managers/Items so we can again be friends.
May its something special if the property is from type \Aimeos\MShop\*\Item\Iface
just one thing: how can i actiavete my new property as checked by default in the backend modules filter?
...all this method are needed in the own Itemclass that the basket works....
(all methods who something do with the private property $locale or $price)
Code: Select all
/**
* Clones internal objects of the order base item.
*/
public function __clone()
{
$this->price = clone $this->price;
$this->locale = clone $this->locale;
}
/**
* Returns the locales for the basic order item.
*
* @return \Aimeos\MShop\Locale\Item\Iface Object containing information
* about site, language, country and currency
*/
public function getLocale()
{
return $this->locale;
}
/**
* Returns a price item with amounts calculated for the products, costs, etc.
*
* @return \Aimeos\MShop\Price\Item\Iface Price item with price, costs and rebate the customer has to pay
*/
public function getPrice(){
if( $this->price->getValue() === '0.00' ){
$this->price->clear();
$currencyId = $this->price->getCurrencyId();
foreach( $this->getServices() as $service ) {
$this->price->addItem( $service->getPrice()->setCurrencyId( $currencyId ) );
}
foreach( $this->getProducts() as $product ) {
$this->price->addItem( $product->getPrice()->setCurrencyId( $currencyId ), $product->getQuantity() );
}
}
return $this->price;
}
/**
* Checks if the price uses the same currency as the price in the basket.
*
* @param \Aimeos\MShop\Price\Item\Iface $item Price item
*/
protected function checkPrice( \Aimeos\MShop\Price\Item\Iface $item )
{
$price = clone $this->price;
$price->addItem( $item );
}
/**
* Tests if the order object was modified.
*
* @return bool True if modified, false if not
*/
public function isModified(){
return ( parent::isModified() === false ? $this->modified : true );
}
/**
* Sets the modified flag of the object.
*/
public function setModified()
{
$this->modified = true;
$this->price->clear();
}
May its something special if the property is from type \Aimeos\MShop\*\Item\Iface
just one thing: how can i actiavete my new property as checked by default in the backend modules filter?