예제 #1
0
 /**
  * Delete Item from Google Content
  *
  * @param Weboffice_GoogleShoppingApi_Model_Item $item
  * @return Weboffice_GoogleShoppingApi_Model_Service_Item
  */
 public function delete($item)
 {
     $gItemId = $item->getGoogleShoppingItemId();
     $service = Mage::getModel('googleshoppingapi/googleShopping');
     $service->deleteProduct($gItemId, $item->getStoreId());
     return $this;
 }
예제 #2
0
 /**
  * Load Item model by product
  *
  * @param Weboffice_GoogleShoppingApi_Model_Item $model
  * @return Weboffice_GoogleShoppingApi_Model_Mysql4_Item
  */
 public function loadByProduct($model)
 {
     if (!$model->getProduct() instanceof Varien_Object) {
         return $this;
     }
     $product = $model->getProduct();
     $productId = $product->getId();
     $storeId = $model->getStoreId() ? $model->getStoreId() : $product->getStoreId();
     $read = $this->_getReadAdapter();
     $select = $read->select();
     if ($productId !== null) {
         $select->from($this->getMainTable())->where("product_id = ?", $productId)->where('store_id = ?', (int) $storeId);
         $data = $read->fetchRow($select);
         $data = is_array($data) ? $data : array();
         $model->addData($data);
     }
     return $this;
 }