Ejemplo n.º 1
0
 /**
  * Retrieve URL to item Product
  *
  * @param  \Magento\Wishlist\Model\Item|\Magento\Catalog\Model\Product $item
  * @param  array $additional
  * @return string
  */
 public function getProductUrl($item, $additional = [])
 {
     if ($item instanceof \Magento\Catalog\Model\Product) {
         $product = $item;
     } else {
         $product = $item->getProduct();
     }
     $buyRequest = $item->getBuyRequest();
     if (is_object($buyRequest)) {
         $config = $buyRequest->getSuperProductConfig();
         if ($config && !empty($config['product_id'])) {
             $product = $this->productRepository->getById($config['product_id'], false, $this->_storeManager->getStore()->getStoreId());
         }
     }
     return $product->getUrlModel()->getUrl($product, $additional);
 }
Ejemplo n.º 2
0
 /**
  * Retrieve URL to item Product
  *
  * @param  \Magento\Wishlist\Model\Item|\Magento\Catalog\Model\Product $item
  * @param  array $additional
  * @return string
  */
 public function getProductUrl($item, $additional = array())
 {
     if ($item instanceof \Magento\Catalog\Model\Product) {
         $product = $item;
     } else {
         $product = $item->getProduct();
     }
     $buyRequest = $item->getBuyRequest();
     if (is_object($buyRequest)) {
         $config = $buyRequest->getSuperProductConfig();
         if ($config && !empty($config['product_id'])) {
             $product = $this->_productFactory->create()->setStoreId($this->_storeManager->getStore()->getStoreId())->load($config['product_id']);
         }
     }
     return parent::getProductUrl($product, $additional);
 }