Пример #1
0
 private function getAssociatedGroupedProduct()
 {
     $associatedProducts = $this->proxyItem->getAssociatedProducts();
     $associatedProductId = reset($associatedProducts);
     $product = Mage::getModel('catalog/product')->setStoreId($this->quote->getStoreId())->load($associatedProductId);
     return $product->getId() ? $product : null;
 }
Пример #2
0
 public function equals(Ess_M2ePro_Model_Order_Item_Proxy $that)
 {
     if (is_null($this->getProductId()) || is_null($that->getProductId())) {
         return false;
     }
     if ($this->getProductId() != $that->getProductId()) {
         return false;
     }
     $thisOptions = $this->getOptions();
     $thatOptions = $that->getOptions();
     $thisOptionsKeys = array_keys($thisOptions);
     $thatOptionsKeys = array_keys($thatOptions);
     $thisOptionsValues = array_values($thisOptions);
     $thatOptionsValues = array_values($thatOptions);
     if (count($thisOptions) != count($thatOptions) || count(array_diff($thisOptionsKeys, $thatOptionsKeys)) > 0 || count(array_diff($thisOptionsValues, $thatOptionsValues)) > 0) {
         return false;
     }
     // grouped products have no options, that's why we have to compare associated products
     $thisAssociatedProducts = $this->getAssociatedProducts();
     $thatAssociatedProducts = $that->getAssociatedProducts();
     if (count($thisAssociatedProducts) != count($thatAssociatedProducts) || count(array_diff($thisAssociatedProducts, $thatAssociatedProducts)) > 0) {
         return false;
     }
     return true;
 }