Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

2 fixes #10

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 1 addition & 7 deletions app/code/community/Yotpo/Yotpo/Block/Yotpo.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,7 @@ public function getProduct()
$this->setData('product', Mage::registry('product'));
}

$product = $this->getData('product');
$configurable_product_model = Mage::getModel('catalog/product_type_configurable');
$parentIds= $configurable_product_model->getParentIdsByChild($product->getId());
if (count($parentIds) > 0) {
$product = Mage::getModel('catalog/product')->load($parentIds[0]);
}
return $product;
return $this->getData('product');
}

public function getProductId()
Expand Down
10 changes: 2 additions & 8 deletions app/code/community/Yotpo/Yotpo/Helper/ApiClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -67,15 +67,9 @@ public function prepareProductsData($order)

foreach ($products as $product) {

//use configurable product instead of simple if still needed
//load product entity
$full_product = Mage::getModel('catalog/product')->load($product->getProductId());

$configurable_product_model = Mage::getModel('catalog/product_type_configurable');
$parentIds= $configurable_product_model->getParentIdsByChild($full_product->getId());
if (count($parentIds) > 0) {
$full_product = Mage::getModel('catalog/product')->load($parentIds[0]);
}

$product_data = array();

$product_data['name'] = $full_product->getName();
Expand All @@ -84,7 +78,7 @@ public function prepareProductsData($order)
try
{
$product_data['url'] = $full_product->getUrlInStore(array('_store' => $order->getStoreId()));
$product_data['image'] = $full_product->getImageUrl();
$product_data['image'] = Mage::helper('catalog/product')->getImageUrl($full_product);
} catch(Exception $e) {}

$product_data['description'] = Mage::helper('core')->htmlEscape(strip_tags($full_product->getDescription()));
Expand Down