This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// get current store and product store to restore values after save | |
$currentStore = $this->storeManager->getStore(); | |
$productStore = $product->getStoreId(); | |
// save to desired storeId | |
$this->storeManager->setCurrentStore($storeId); | |
$product->setStoreId($storeId); | |
// you can use also $product->setName ... | |
$product->setData($attributeCode, $value); | |
$this->productResource->saveAttribute($product, $attributeCode); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class Orchid_CouponFix_Model_Observer | |
{ | |
public function cancel($observer) | |
{ | |
$resource = Mage::getModel('core/resource'); | |
$db = $resource->getConnection('core_write'); | |
$event = $observer->getEvent(); | |
$order = $event->getPayment()->getOrder(); | |
if ($order->canCancel()) { |