public function editAction() { if ($this->getCurrentOptionValue()) { $product = new Catalog_Model_Product(); if ($product_id = $this->getRequest()->getParam('id')) { $product->find($product_id); if ($product->getId() and $product->getValueId() != $this->getCurrentOptionValue()->getId()) { throw new Exception($this->_('An error occurred while loading your product.')); } } else { if ($category_id = $this->getRequest()->getParam('category_id')) { $category = new Catalog_Model_Category(); $category->find($category_id); if ($category->getValueId() != $this->getCurrentOptionValue()->getId()) { $category = null; $category_id = Catalog_Model_Category(); } $product->setCategory($category)->setCategoryId($category_id); } } $this->loadPartials(null, false); $this->getLayout()->getPartial('content')->setOptionValue($this->getCurrentOptionValue())->setProduct($product); $html = $this->getLayout()->render(); $this->getLayout()->setHtml($html); } }