Example #1
0
 /**
  * Import inventory data
  *
  * @param \XLite\Model\Product $product Product
  * @param string               $data    Data
  * @param string               $name    Cell name
  *
  * @return void
  */
 protected function importInventory(\XLite\Model\Product $product, $data, $name)
 {
     if ('inventoryEnabled' == $name) {
         $name = 'enabled';
     }
     $method = 'set' . ucfirst($name);
     $product->getInventory()->{$method}($data);
     if (!$product->getInventory()->getInventoryId()) {
         $product->setInventory($product->getInventory());
         $product->getInventory()->setProduct($product);
     }
 }
Example #2
0
 /**
  * Clone entity (inventory)
  *
  * @param \XLite\Model\Product $newProduct New product
  *
  * @return void
  */
 protected function cloneEntityInventory(\XLite\Model\Product $newProduct)
 {
     $inventory = $this->getInventory()->cloneEntity();
     $newProduct->setInventory($inventory);
     $inventory->setProduct($newProduct);
 }
 /**
  * {@inheritDoc}
  */
 public function setInventory(\XLite\Model\Inventory $inventory = NULL)
 {
     $this->__initializer__ && $this->__initializer__->__invoke($this, 'setInventory', array($inventory));
     return parent::setInventory($inventory);
 }