Skip to content
Permalink
Browse files

Intial commit to see if these changes fix problems in Magento 1.5 wit…

…h errors adding to cart not redirecting back to the right place
  • Loading branch information...
toasty committed Jun 17, 2011
1 parent d7830db commit c137e4bf979fcc645466352a6ead41058538267b
@@ -23,4 +23,18 @@ public function isVisibleInSiteVisibility()
return parent::isVisibleInSiteVisibility();
}
}
public function getProductUrl($useSid = null)
{
if(is_callable(array($this->getTypeInstance(), 'hasConfigurableProductParentId'))
&& $this->getTypeInstance()->hasConfigurableProductParentId()) {
$confProdId = $this->getTypeInstance()->getConfigurableProductParentId();
return Mage::getModel('catalog/product')->load($confProdId)->getProductUrl();
} else {
return parent::getProductUrl($useSid);
}
}
}
@@ -2,6 +2,26 @@
class OrganicInternet_SimpleConfigurableProducts_Catalog_Model_Product_Type_Simple
extends Mage_Catalog_Model_Product_Type_Simple
{
#Later this should be refactored to live elsewhere probably,
#but it's ok here for the time being
private function getCpid()
{
$cpid = $this->getProduct()->getCustomOption('cpid');
if ($cpid) {
return $cpid;
}
$br = $this->getProduct()->getCustomOption('info_buyRequest');
if ($br) {
$brData = unserialize($br->getValue());
if(!empty($brData['cpid'])) {
return $brData['cpid'];
}
}
return false;
}
public function prepareForCart(Varien_Object $buyRequest, $product = null)
{
$product = $this->getProduct($product);
@@ -14,9 +34,13 @@ public function prepareForCart(Varien_Object $buyRequest, $product = null)
public function hasConfigurableProductParentId()
{
if ($this->getProduct()->getCustomOption('cpid')) {
return true;
}
return false;
$cpid = $this->getCpid();
Mage::log("cpid: ". $cpid);
return !empty($cpid);
}
public function getConfigurableProductParentId()
{
return $this->getCpid();
}
}

3 comments on commit c137e4b

@myforgedoteu

This comment has been minimized.

Copy link

replied Feb 23, 2012

works for me on 1.5.1
thanks.

@thomas-harding

This comment has been minimized.

Copy link

replied Aug 4, 2016

Works great on 1.9.2.4 too. Thanks!

@brb-elia

This comment has been minimized.

Copy link

replied Mar 3, 2017

Make the same thing on OrganicInternet_SimpleConfigurableProducts_Catalog_Model_Product_Type_Virtual

Please sign in to comment.
You can’t perform that action at this time.