Close

August 3, 2017

Quick Tip – Setting Amasty Order Attribute Values

Quick Tip we are keeping for later use. We love Amasty’s Custom Order Attributes Plugin but we couldn’t find a clean method on how to setup the order attributes for later warehouse and/or data processing after the order had been generated. Listed below is a snippet of code that is simple enough to use and expand the use of the plugin.

 
	    $attributes = Mage::getModel('amorderattr/attribute');
            $attributes->load($order_id, 'order_id');
            $attributes->setData('order_wh_status', "123woot");
            $attributes->setData('order_id', $order_id); //not sure if needed..was in their source code so I kept it.
            $attributes->save();

Fatal error: Uncaught Error: [] operator not supported for strings in /home/silvatec/public_html/wp-content/themes/layerswp/core/helpers/post.php:62 Stack trace: #0 /home/silvatec/public_html/wp-content/themes/layerswp/partials/content-single.php(81): layers_post_meta(3978) #1 /home/silvatec/public_html/wp-includes/template.php(690): require('/home/silvatec/...') #2 /home/silvatec/public_html/wp-includes/template.php(647): load_template('/home/silvatec/...', false) #3 /home/silvatec/public_html/wp-includes/general-template.php(167): locate_template(Array, true, false) #4 /home/silvatec/public_html/wp-content/themes/layerswp/single.php(20): get_template_part('partials/conten...', 'single') #5 /home/silvatec/public_html/wp-includes/template-loader.php(74): include('/home/silvatec/...') #6 /home/silvatec/public_html/wp-blog-header.php(19): require_once('/home/silvatec/...') #7 /home/silvatec/public_html/index.php(17): require('/home/silvatec/...') #8 {main} thrown in /home/silvatec/public_html/wp-content/themes/layerswp/core/helpers/post.php on line 62