1

I have a protected array.

class Tric_FullCircle_Model_Product_Adapter extends OnePica_FullCircle_Model_Product_Adapter
{
    /**
     * Global company number
     */
    protected $_globalCompanyNumber = null;

    /**
     * Tax Classes
     */
    protected $_taxClasses = null;

    /**
     * Attributes to update
     *
     * @var array
     */    


protected $_attributesToUpdate = array( 
    'name', 
    'description', 
    'price', 
    'tax_class_id', 
    'weight', 
    'country_of_manufacture', 
    'specifications', 
    'tric_cn', 
    'tric_style', 
    'tric_color', 
    'tric_div', 
    'tric_div_desc', 
    );

I want to add 'special_price' if it matches a particular default store which 1.

I keep throwing syntax errors in my protected variable array. Do i use an array_diff? or just append it like this $arr[] = 'special_price';

I tried something like this

    if (Mage::app()->getStore()->getStoreId() !== Mage::app()->getWebsites()[1]->getDefaultStore()->getStoreId()) {
           $arr[] = 'special_price';

   }

and this

if (Mage::app()->getStore()->getStoreId() === Mage::app()->getWebsites()[1]->getDefaultStore()->getStoreId()) {
           $_attributesToUpdate = array_diff(fieldNames, array('special_price'));

Any help would be appreciated. Thank you.

thismethod
  • 523
  • 1
  • 6
  • 25

1 Answers1

1

Access your protected array with $this->

Change

arr[] = 'special_price';

To

$this->arr[] = 'special_price';

OR

Change

_attributesToUpdate = array_diff(fieldNames, array('special_price'));

To

$this->_attributesToUpdate = array_diff(fieldNames, array('special_price'));
Zayn Ali
  • 4,765
  • 1
  • 30
  • 40