Example #1
0
 /**
  * Formating date value before save
  *
  * Should set (bool, string) correct type for empty value from html form,
  * neccessary for farther proccess, else date string
  *
  * @param Varien_Object $object
  * @throws Mage_Eav_Exception
  * @return Mage_Eav_Model_Entity_Attribute_Backend_Datetime
  */
 public function beforeSave($object)
 {
     $attributeName = $this->getAttribute()->getName();
     $_formated = $object->getData($attributeName . '_is_formated');
     if (!$_formated && $object->hasData($attributeName)) {
         try {
             if (Mage::app()->getLocale()->getLocale() == 'fa_IR') {
                 require_once Mage::getBaseDir('lib') . '/pdate/pdate.php';
                 if ($object->getData($attributeName) != NULL) {
                     list($j_y, $j_m, $j_d) = explode('/', $object->getData($attributeName));
                     $gregorianlArray = jalali_to_gregorian($j_y, $j_m, $j_d);
                     $date = implode('-', $gregorianlArray);
                     $object->setData($attributeName, $date);
                 }
             }
             $value = $this->formatDate($object->getData($attributeName));
         } catch (Exception $e) {
             throw Mage::exception('Mage_Eav', Mage::helper('eav')->__('Invalid date'));
         }
         if (is_null($value)) {
             $value = $object->getData($attributeName);
         }
         //Mage::log( "$attributeName, $value ") ;
         $object->setData($attributeName, $value);
         $object->setData($attributeName . '_is_formated', true);
     }
     return $this;
 }
 /**
  * Render for Content
  *
  * @param   Varien_Object $row
  * @return  string
  */
 public function render(Varien_Object $row)
 {
     $typeId = $row->getData('type_id');
     $configSku = "";
     if ($typeId == "configurable") {
         $configSku = $row->getData($this->getColumn()->getIndex());
     } else {
         if ($typeId == "simple") {
             $simpleProductId = $row->getData('entity_id');
             $objConfigProduct = Mage::getModel('catalog/product_type_configurable');
             $arrConfigProductIds = $objConfigProduct->getParentIdsByChild($simpleProductId);
             $configSkuArr = array();
             if (is_array($arrConfigProductIds)) {
                 foreach ($arrConfigProductIds as $sid) {
                     $pr = Mage::getModel('catalog/product')->load($sid);
                     $configSkuArr[] = $pr->getSku();
                 }
             }
             if (count($configSkuArr) > 0) {
                 $configSku = implode(", ", $configSkuArr);
             }
         }
     }
     return $configSku;
 }
Example #3
0
 protected function _prepareCollection()
 {
     $resource = Mage::getSingleton('core/resource');
     $filterData = new Varien_Object();
     $requestData = Mage::helper('adminhtml')->prepareFilterString($this->getRequest()->getParam('top_filter'));
     foreach ($requestData as $key => $value) {
         if (!empty($value)) {
             $filterData->setData($key, $value);
         }
     }
     $dateFrom = $filterData->getData('date_from');
     $dateTo = $filterData->getData('date_to');
     if (!$dateTo) {
         $dateTo = now();
     } else {
         $dateTo .= ' 23:59:59';
     }
     $collection = Mage::getModel('inventoryplus/warehouse_shipment')->getCollection();
     $collection->getSelect()->joinLeft(array('shipment_item' => $resource->getTableName('sales/shipment_item')), "main_table.shipment_id = shipment_item.parent_id" . " and main_table.product_id = shipment_item.product_id" . " and shipment_item.order_item_id = main_table.item_id", array('*'))->join(array('shipment' => $resource->getTableName('sales/shipment')), "main_table.shipment_id = shipment.entity_id" . " and shipment.created_at between '{$dateFrom}' and '{$dateTo}'", array(''))->join(array('warehouse' => $resource->getTableName('inventoryplus/warehouse')), "main_table.warehouse_id = warehouse.warehouse_id", array('*'));
     $collection->getSelect()->group(array('warehouse.warehouse_id'));
     $collection->getSelect()->columns(array('warehouse_name' => 'warehouse.warehouse_name', 'total_shipment' => 'SUM(main_table.qty_shipped)', 'sales_total' => 'SUM(shipment_item.qty * shipment_item.price)'));
     $collection->setIsGroupCountSql(true);
     $this->setCollection($collection);
     return parent::_prepareCollection();
 }
 /**
  * Display customer type 1 = VIP, 2 = Normal, 3 = Not Satisfied
  * 
  * @param Varien_Object $row
  * @return string
  */
 public function render(Varien_Object $row)
 {
     $html = '';
     $customerPhone = $row->getData('telephone');
     $customerEmail = $row->getData('email');
     $customerName = $row->getData('name');
     $customerType = $row->getData('customer_satisfaction_type');
     switch ($customerType) {
         case 1:
             if ($customerPhone) {
                 $html .= '<div style="font: Arial, Helvetica, sans-serif;font-weight: bold;background-color:#3CB861;color:#fff;width:100%;height:100%"> ' . $customerPhone . ' - ' . $customerName . ' </div>';
             } else {
                 $html .= '<div style="font: Arial, Helvetica, sans-serif;font-weight: bold;background-color:#3CB861;color:#fff;width:100%;height:100%"> ' . $customerEmail . ' - ' . $customerName . ' </div>';
             }
             break;
         case 2:
             if ($customerPhone) {
                 $html .= '<div style="font: Arial, Helvetica, sans-serif;font-weight: bold;background-color:#589AFF;color:#fff;width:100%;height:100%"> ' . $customerPhone . ' - ' . $customerName . ' </div>';
             } else {
                 $html .= '<div style="font: Arial, Helvetica, sans-serif;font-weight: bold;background-color:#589AFF;color:#fff;width:100%;height:100%"> ' . $customerEmail . ' - ' . $customerName . ' </div>';
             }
             break;
         case 3:
             if ($customerPhone) {
                 $html .= '<div style="font: Arial, Helvetica, sans-serif;font-weight: bold;background-color:#E41101;color:#fff;width:100%;height:100%"> ' . $customerPhone . ' - ' . $customerName . ' </div>';
             } else {
                 $html .= '<div style="font: Arial, Helvetica, sans-serif;font-weight: bold;background-color:#E41101;color:#fff;width:100%;height:100%"> ' . $customerEmail . ' - ' . $customerName . ' </div>';
             }
             break;
         default:
             break;
     }
     return $html;
 }
Example #5
0
 public function render(Varien_Object $row)
 {
     if ($row->getData('customer_id')) {
         return sprintf('<a href="%s" title="%s">%s</a>', $this->getUrl('adminhtml/customer/edit/', array('id' => $row->getData('customer_id'))), Mage::helper('luckydraw')->__('View Customer Detail'), $row->getData('email'));
     }
     return $row->getData('email');
 }
Example #6
0
 /**
  * Get changes that were made to source model
  *
  * @param Varien_Object $source
  * @return array
  */
 public function getChanges(Varien_Object $source)
 {
     $changes = array();
     foreach ($this->_possibleChanges as $code => $label) {
         if ($source->getData($code) != $source->getOrigData($code)) {
             switch ($code) {
                 case 'customer_id':
                     $fromCustomer = Mage::getModel('customer/customer')->load($source->getOrigData($code));
                     $from = $fromCustomer->getFirstname() . ' ' . $fromCustomer->getLastname() . ' (ID: ' . $fromCustomer->getId() . ')';
                     $toCustomer = Mage::getModel('customer/customer')->load($source->getData($code));
                     $to = $toCustomer->getFirstname() . ' ' . $toCustomer->getLastname() . ' (ID: ' . $toCustomer->getId() . ')';
                     break;
                 case 'customer_group_id':
                     $fromGroup = Mage::getModel('customer/group')->load($source->getOrigData($code));
                     $from = $fromGroup->getCode();
                     $toGroup = Mage::getModel('customer/group')->load($source->getData($code));
                     $to = $toGroup->getCode();
                     break;
                 case 'method':
                     $from = Mage::helper('payment')->getMethodInstance($source->getOrigData('method'))->getTitle();
                     $to = Mage::helper('payment')->getMethodInstance($source->getData('method'))->getTitle();
                     break;
                 default:
                     $from = $source->getOrigData($code);
                     $to = $source->getData($code);
             }
             $changes[$code] = array('from' => $from, 'to' => $to);
         }
     }
     return $changes;
 }
 /**
  * {@inheritdoc}
  */
 public function render(Varien_Object $row)
 {
     if (!$row->getData('message_id')) {
         return 'Unavailable';
     }
     return $row->getData('message_id');
 }
 public function render(Varien_Object $row)
 {
     if ($row->getData('total_inventory') || $row->getData('total_inventory') != null) {
         return parent::render($row);
     }
     return $this->__('N/A');
 }
 /**
  * Assign extra parameters to row
  *
  * @param Varien_Object $row
  */
 protected function _prepareArrayRow(Varien_Object $row)
 {
     $row->setData('option_extra_attr_' . $this->_getTemplateRenderer()->calcOptionHash($row->getData('template')), 'selected="selected"');
     $row->setData('option_extra_attr_' . $this->_getSendtypeRenderer()->calcOptionHash($row->getData('sendtype')), 'selected="selected"');
     $row->setData('option_extra_attr_' . $this->_getDatafieldRenderer()->calcOptionHash($row->getData('datafield')), 'selected="selected"');
     $row->setData('option_extra_attr_' . $this->_getFromadddressRenderer()->calcOptionHash($row->getData('fromaddress')), 'selected="selected"');
 }
Example #10
0
 public function render(Varien_Object $row)
 {
     if (!$row->getData($this->getColumn()->getIndex())) {
         return null;
     }
     return '<a title="' . Mage::helper('core')->__('Edit Store') . '" href="' . $this->getUrl('*/*/editGroup', array('group_id' => $row->getGroupId())) . '">' . $row->getData($this->getColumn()->getIndex()) . '</a>';
 }
Example #11
0
 public function render(Varien_Object $row)
 {
     $today = date("Y-m-d 23:59:59");
     $value = $row->getData('increment_order_id');
     $shipping_method = $row->getData('shipping_method');
     $connection = Mage::getSingleton('core/resource')->getConnection('core_read');
     //$sql = "SELECT `order_id` FROM  `sales_flat_order_item_stitching` WHERE `increment_order_id`='".$value."'";
     $sql = "SELECT SUM(  `qty` ) as qtyo FROM  `sales_flat_order_item_stitching` WHERE  `increment_order_id` ='" . $value . "'";
     //echo $sql."==KK";
     $rows = $connection->fetchAll($sql);
     //$tot_order_qty_stitching = count($rows);
     $tot_order_qty_stitching = $rows[0]['qtyo'];
     //$order_id = $rows[0]['order_id'];
     $order_id = $row->getData('order_id');
     $sql1 = "SELECT SUM(  `qty_ordered` ) as qty FROM  `sales_flat_order_item` WHERE  `order_id` ='" . $order_id . "'";
     //echo $sql1."==KK";
     $rows1 = $connection->fetchAll($sql1);
     $tot_order_qty = $rows1[0]['qty'];
     $color = '';
     if ($tot_order_qty_stitching != $tot_order_qty) {
         $color1 = 'style="color:red;text-decoration:blink;font-weight:bold;text-decoration:blink;"';
         return $value . '<p ' . $color1 . '> Qty Diff. </p> ';
     } else {
         return $value;
     }
 }
Example #12
0
 protected function _getValue(Varien_Object $row)
 {
     $useConfig = false;
     $fieldType = $this->getColumn()->getFieldType();
     if ($this->getColumn()->getCanUseConfig()) {
         if ($row->getData($this->getColumn()->getUseConfigIndex())) {
             $useConfig = true;
             if ($this->getColumn()->getFieldName() == 'min_sale_qty') {
                 $data = Mage::helper('cataloginventory/minsaleqty')->getConfigValue(Mage_Customer_Model_Group::CUST_GROUP_ALL);
             } else {
                 $data = Mage::getStoreConfig($this->getColumn()->getSystemConfigPath());
             }
         }
     }
     if (!$useConfig) {
         $data = $row->getData($this->getColumn()->getIndex());
     }
     if ($fieldType == 'boolean') {
         $data = Mage::helper('customgrid')->__($data ? 'Yes' : 'No');
     } elseif ($fieldType == 'decimal') {
         $data *= 1;
     } elseif ($fieldType == 'options' && is_array($hash = $this->getColumn()->getOptionsHash()) && isset($hash[$data])) {
         $data = $hash[$data];
     }
     $data = strval($data);
     if ($useConfig) {
         if (($text = $this->getColumn()->getUseConfigPrefix()) !== '') {
             $data = $text . ' ' . $data;
         }
         if (($text = $this->getColumn()->getUseConfigSuffix()) !== '') {
             $data .= ' ' . $text;
         }
     }
     return $data;
 }
Example #13
0
 public function render(Varien_Object $row)
 {
     if ($row->getData("last_popup_id")) {
         $value = "<b>ID " . $row->getData("last_popup_id") . "</b> - " . $row->getData("popup_title");
     }
     return '<span>' . $value . '</span>';
 }
 /**
  * {@inheritdoc}
  */
 public function render(Varien_Object $row)
 {
     $total = $row->getData('successes');
     $total += $row->getData('duplicates');
     $total += $row->getData('failures');
     return $total;
 }
Example #15
0
 public function render(Varien_Object $row)
 {
     $value = (int) $row->getData($this->getColumn()->getIndex());
     $id = (int) $row->getData('slide_id');
     $input = sprintf('<input type="text" class="input-text " value="%d" name="slides_position[%d]" />', $value, $id);
     return $input;
 }
Example #16
0
 protected function _prepareForm()
 {
     $form = new Varien_Data_Form();
     $blockData = Mage::registry(AW_Autorelated_Adminhtml_ShoppingcartblockController::BLOCK_REGISTRY_KEY);
     if (!$blockData instanceof Varien_Object) {
         $blockData = new Varien_Object();
     }
     $fieldset = $form->addFieldset('general', array('legend' => $this->__('General')));
     $fieldset->addField('name', 'text', array('name' => 'name', 'label' => $this->__('Name'), 'required' => true));
     if ($blockData->getData('status') === null) {
         $blockData->setData('status', 1);
     }
     $fieldset->addField('status', 'select', array('name' => 'status', 'label' => $this->__('Status'), 'required' => true, 'values' => Mage::getModel('awautorelated/source_status')->toOptionArray()));
     if (!Mage::app()->isSingleStoreMode()) {
         $fieldset->addField('store', 'multiselect', array('name' => 'store[]', 'label' => $this->__('Store View'), 'required' => true, 'values' => Mage::getSingleton('adminhtml/system_store')->getStoreValuesForForm(false, true)));
     } else {
         $blockData->setStore(Mage::app()->getStore(true)->getId());
         $fieldset->addField('store', 'hidden', array('name' => 'store[]'));
     }
     if ($blockData->getData('customer_groups') === null) {
         $blockData->setData('customer_groups', array(Mage_Customer_Model_Group::CUST_GROUP_ALL));
     }
     $fieldset->addField('customer_groups', 'multiselect', array('name' => 'customer_groups[]', 'label' => $this->__('Customer groups'), 'title' => $this->__('Customer groups'), 'required' => true, 'values' => Mage::getModel('awautorelated/source_customer_groups')->toOptionArray()));
     $fieldset->addField('priority', 'text', array('name' => 'priority', 'label' => $this->__('Priority'), 'title' => $this->__('Priority'), 'required' => false));
     $dateFormatIso = Mage::app()->getLocale()->getDateFormat(Mage_Core_Model_Locale::FORMAT_TYPE_SHORT);
     $fieldset->addField('date_from', 'date', array('name' => 'date_from', 'label' => $this->__('Date From'), 'image' => $this->getSkinUrl('images/grid-cal.gif'), 'input_format' => Varien_Date::DATE_INTERNAL_FORMAT, 'format' => $dateFormatIso));
     $fieldset->addField('date_to', 'date', array('name' => 'date_to', 'label' => $this->__('Date To'), 'image' => $this->getSkinUrl('images/grid-cal.gif'), 'input_format' => Varien_Date::DATE_INTERNAL_FORMAT, 'format' => $dateFormatIso));
     $positionSourceModel = Mage::getModel('awautorelated/source_position');
     $fieldset->addField('position', 'select', array('name' => 'position', 'label' => $this->__('Position'), 'title' => $this->__('Position'), 'required' => true, 'values' => $positionSourceModel->toOptionArray(AW_Autorelated_Model_Source_Type::SHOPPING_CART_BLOCK)));
     $form->setValues($blockData->toArray());
     $this->setForm($form);
 }
Example #17
0
 public function render(Varien_Object $row)
 {
     if ($row->getData('attribute_page_id') > 0) {
         return $row->getData('name');
     }
     return '<i style="font-size: smaller; color: #999">Click to add info</i>';
 }
Example #18
0
 /**
  * @param Varien_Object $data
  * @return array|null
  */
 protected function _getLocaleRecord(Varien_Object $data)
 {
     if ($data->hasData('language') && $data->hasData('country')) {
         return array('language' => (string) $data->getData('language'), 'country' => (string) $data->getData('country'), 'variant' => null);
     }
     return null;
 }
 public function render(Varien_Object $row)
 {
     if (version_compare(Mage::getVersion(), '1.12.0.0', '>=')) {
         $rule_id = $row->getData('rule_id');
         $collection = Mage::getModel('salesrule/rule')->load($rule_id);
         $collection->getCollection()->getSelect()->join(array('table_alias' => Mage::getSingleton('core/resource')->getTableName('salesrule_customer_group')), 'main_table.rule_id = table_alias.rule_id', array('table_alias.*'));
         $sGroups = implode(',', $collection->getData($this->getColumn()->getIndex()));
     } else {
         $sGroups = $row->getData($this->getColumn()->getIndex());
     }
     if ($sGroups or $sGroups === '0') {
         $oAitindividpromo = Mage::getModel('aitindividpromo/aitindividpromo');
         $aCustomerGroupHash = $oAitindividpromo->getCustomerGroups(false);
         $aRowGroupHash = explode(',', $sGroups);
         $aRowGroupName = array();
         foreach ($aRowGroupHash as $iKey) {
             if (isset($aCustomerGroupHash[$iKey])) {
                 $aRowGroupName[] = $aCustomerGroupHash[$iKey];
             }
         }
         $sHtml = implode(', ', $aRowGroupName);
         return $sHtml;
     } else {
         return '&nbsp;';
     }
 }
Example #20
0
 protected function _checkUnique(Mage_Core_Model_Abstract $object)
 {
     $existent = array();
     $rateValueArray = array();
     if (!empty($this->_uniqueFields)) {
         if (!is_array($this->_uniqueFields)) {
             $this->_uniqueFields = array(array('field' => $this->_uniqueFields, 'title' => $this->_uniqueFields));
         }
         $data = new Varien_Object($this->_prepareDataForSave($object));
         $select = $this->_getWriteAdapter()->select()->from($this->getMainTable());
         foreach ($this->_uniqueFields as $unique) {
             $select->reset(Zend_Db_Select::WHERE);
             if (is_array($unique['field'])) {
                 foreach ($unique['field'] as $field) {
                     $select->where($field . '=?', $data->getData($field));
                     $rateValueArray[] = $this->_getWriteAdapter()->quoteInto($field . '=?', $data->getData($field));
                 }
             } else {
                 $select->where($unique['field'] . ' = ?', $data->getData($unique['field']));
                 $rateValueArray[] = $this->_getWriteAdapter()->quoteInto($unique['field'] . ' = ?', $data->getData($unique['field']));
             }
             if ($object->getId()) {
                 $select->where($this->getIdFieldName() . ' != ?', $object->getId());
             }
             if ($test = $this->_getWriteAdapter()->fetchRow($select)) {
                 $existent[] = $test['tax_rate_id'];
             }
         }
     }
     if (!empty($existent)) {
         $this->_getWriteAdapter()->delete($this->getMainTable(), $rateValueArray);
     }
 }
Example #21
0
 public function render(Varien_Object $row)
 {
     if ($row->getData('order_id')) {
         return sprintf('<a href="%s" title="%s">%s</a>', $this->getUrl('adminhtml/sales_order/view/', array('order_id' => $row->getData('order_id'))), Mage::helper('luckydraw')->__('View Order Detail'), $row->getData('order_increment_id'));
     }
     return '';
 }
Example #22
0
 /**
  * Renders the barcode column. This column will be empty for non-MyParcel shipments.
  * If the shipment has been confirmed, it will be displayed as a track& trace URL.
  * Otherwise the bare code will be displayed.
  *
  * @param Varien_Object $row
  *
  * @return string
  */
 public function render(Varien_Object $row)
 {
     /**
      * The shipment was not shipped using MyParcel
      */
     $shippingMethod = $row->getData(self::SHIPPING_METHOD_COLUMN);
     if (!Mage::helper('tig_myparcel')->shippingMethodIsMyParcel($shippingMethod)) {
         return '';
     }
     /**
      * Check if any data is available.
      */
     $value = $row->getData($this->getColumn()->getIndex());
     if (!$value) {
         return '';
     }
     /**
      * Create a track & trace URL based on shipping destination
      */
     $countryCode = $row->getData(self::COUNTRY_ID_COLUMN);
     $postcode = $row->getData(self::POSTCODE_COLUMN);
     $destinationData = array('countryCode' => $countryCode, 'postcode' => $postcode);
     $barcode = $row->getData(self::BARCODE_COLUMN);
     if (!empty($barcode)) {
         $barcodeUrl = Mage::helper('tig_myparcel')->getBarcodeUrl($barcode, $destinationData, false, true);
         $barcodeHtml = "<a href='{$barcodeUrl}' target='_blank'>{$barcode}</a> - <small>" . $this->__('status_' . $value) . "</small>";
     } else {
         $barcodeHtml = "<small>" . $this->__('status_' . $value) . "</small>";
     }
     return $barcodeHtml;
 }
Example #23
0
 public function render(Varien_Object $row)
 {
     if ($row->getData('program_name')) {
         return sprintf('<a href="%s" title="%s">%s</a>', $this->getUrl('*/adminhtml_program/edit', array('id' => $row->getData('program_id'))), Mage::helper('luckydraw')->__('View Program Detail'), $row->getData('program_name'));
     }
     return '';
 }
Example #24
0
 /**
  * Render for Content
  *
  * @param   Varien_Object $row
  * @return  string
  */
 public function render(Varien_Object $row)
 {
     $cache = Mage::app()->getCache();
     $cacheKey = md5('STATES_DATA');
     if ($serialArray = $cache->load($cacheKey)) {
         $region_id = $row->getData($this->getColumn()->getIndex());
         $statesArray = unserialize($serialArray);
         return $statesArray[$region_id];
     } else {
         $region_id = $row->getData($this->getColumn()->getIndex());
         $states = array();
         $resource = Mage::getSingleton('core/resource');
         $readConnection = $resource->getConnection('core_read');
         $query = 'SELECT region_id, default_name FROM ' . $resource->getTableName('directory_country_region') . '';
         $readresult = $readConnection->query($query);
         while ($row = $readresult->fetch()) {
             $states[$row['region_id']] = $row['default_name'];
         }
         $cache->save(serialize($states), $cacheKey, array("states_data_cache"), 86400);
         return $states[$region_id];
     }
     /*$region_id = $row->getData($this->getColumn()->getIndex());
     
             $resource = Mage::getSingleton('core/resource');
             $readConnection = $resource->getConnection('core_read');
     
             $query = 'SELECT default_name FROM ' . $resource->getTableName('directory_country_region') . ' WHERE region_id = "'.$region_id.'" ';
             $result = $readConnection->fetchRow($query);
     
             return $result['default_name'];*/
 }
Example #25
0
 public function render(Varien_Object $row)
 {
     if ($getter = $this->getColumn()->getGetter()) {
         $val = $row->{$getter}();
     }
     $html = "";
     $typeId = $row->getData('type_id');
     if ($typeId == 'simple') {
         $val = $row->getData($this->getColumn()->getIndex());
         //$val = str_replace("no_selection", "", $val);
         $_swatchImage = Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_SKIN) . 'frontend/enterprise/lecom/images/NA.jpg';
         $_mediaUrl = Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_MEDIA) . 'catalog/product';
         /*
         $swatchImgWidth = Mage::getStoreConfig('colorswatch/general/swatch_image_width');
         if($swatchImgWidth == "" || strtolower($swatchImgWidth) == "null") {
         	$swatchImgWidth = 20;
         }
         
         $swatchImgHeight = Mage::getStoreConfig('colorswatch/general/swatch_image_height');
         
         if($swatchImgHeight == "" || strtolower($swatchImgHeight) == "null") {
         	$swatchImgHeight = 20;
         }
         */
         if (!empty($val) && $val != "no_selection" && file_exists(Mage::getBaseDir('media') . '/catalog/product/' . $val)) {
             $_swatchImage = $_mediaUrl . $val;
             //$_swatchImage = Mage::helper('catalog/image')->init($_productchild,'color_swatch_image')->resize($swatchImgWidth,$swatchImgHeight);
         }
         $html = '<img ';
         $html .= 'id="' . $this->getColumn()->getId() . '" ';
         $html .= 'src="' . $_swatchImage . '"';
         $html .= 'class="grid-image ' . $this->getColumn()->getInlineCss() . '" width="20" height="20" />';
     }
     return $html;
 }
    public function render(Varien_Object $_order)
    {
        if (!$_order->isEnabled()) {
            return;
        }
        if ($msg = $_order->has_errors()) {
            echo $msg;
            return;
        }
        if ($_order->getData('reminder_sent')) {
            ?>
We have emailed you a reminder for this order.<?php 
        }
        if (Mage::helper('recorder')->dateHasPassedOrIsToday($_order->getData('start_date'))) {
            ?>
Your order #<?php 
            echo $_order->getId();
            ?>
 has passed all checks and is ready to be placed tonight!<?php 
            return;
        }
        if ($_order->canSendReminder()) {
            ?>
Tonight we'll be sending you a reminder email about this recurring order.<?php 
        }
    }
 /**
  * Change color of row for each type of customer
  * 
  * @param Varien_Object $row
  * @return string
  */
 public function render(Varien_Object $row)
 {
     $customerId = $row->getData('entity_id');
     $showNotesUrl = Mage::helper("adminhtml")->getUrl('inventorycustomeradmin/adminhtml_customertypes/notes', array('id' => $customerId));
     $customerType = $row->getData('customer_satisfaction_type');
     $customerEmail = $row->getData('email');
     $customerPhone = $row->getData('telephone');
     $customerName = $row->getData('name');
     $html = '';
     switch ($customerType) {
         case 1:
             if ($customerPhone) {
                 $html .= "<div id='customer" . $customerId . "' draggable='true' ondragstart='handleDrag(event)' class='customer-types-grid-row' style='background-color:#29A329;'> " . $customerPhone . " - " . $customerName . " <a class='customer-types-notes-link' href='' onclick='window.open( " . "\"" . $showNotesUrl . "\"" . "," . "\"" . $this->__('Notes') . "\"" . "," . "\"" . 'scrollbars=yes, resizable=yes, width=1000, height=300, top=150, left=200' . "\"" . "); return false;' target='_blank'>" . $this->__('(i)') . "</a>" . " </div>";
             } else {
                 $html .= "<div id='customer" . $customerId . "' draggable='true' ondragstart='handleDrag(event)' class='customer-types-grid-row' style='background-color:#29A329;'> " . $customerEmail . " - " . $customerName . " <a class='customer-types-notes-link' href='' onclick='window.open( " . "\"" . $showNotesUrl . "\"" . "," . "\"" . $this->__('Notes') . "\"" . "," . "\"" . 'scrollbars=yes, resizable=yes, width=1000, height=300, top=150, left=200' . "\"" . "); return false;' target='_blank'>" . $this->__('(i)') . "</a>" . " </div>";
             }
             break;
         case 2:
             if ($customerPhone) {
                 $html .= "<div id='customer" . $customerId . "' draggable='true' ondragstart='handleDrag(event)' class='customer-types-grid-row' style='background-color:#008AE6;'> " . $customerPhone . " - " . $customerName . " <a class='customer-types-notes-link' href='' onclick='window.open( " . "\"" . $showNotesUrl . "\"" . "," . "\"" . $this->__('Notes') . "\"" . "," . "\"" . 'scrollbars=yes, resizable=yes, width=1000, height=300, top=150, left=200' . "\"" . "); return false;' target='_blank'>" . $this->__('(i)') . "</a>" . " </div>";
             } else {
                 $html .= "<div id='customer" . $customerId . "' draggable='true' ondragstart='handleDrag(event)' class='customer-types-grid-row' style='background-color:#008AE6;'> " . $customerEmail . " - " . $customerName . " <a class='customer-types-notes-link' href='' onclick='window.open( " . "\"" . $showNotesUrl . "\"" . "," . "\"" . $this->__('Notes') . "\"" . "," . "\"" . 'scrollbars=yes, resizable=yes, width=1000, height=300, top=150, left=200' . "\"" . "); return false;' target='_blank'>" . $this->__('(i)') . "</a>" . " </div>";
             }
             break;
         case 3:
             if ($customerPhone) {
                 $html .= "<div id='customer" . $customerId . "' draggable='true' ondragstart='handleDrag(event)' class='customer-types-grid-row' style='background-color:#E60000;'> " . $customerPhone . " - " . $customerName . " <a class='customer-types-notes-link' href='' onclick='window.open( " . "\"" . $showNotesUrl . "\"" . "," . "\"" . $this->__('Notes') . "\"" . "," . "\"" . 'scrollbars=yes, resizable=yes, width=1000, height=300, top=150, left=200' . "\"" . "); return false;' target='_blank'>" . $this->__('(i)') . "</a>" . " </div>";
             } else {
                 $html .= "<div id='customer" . $customerId . "' draggable='true' ondragstart='handleDrag(event)' class='customer-types-grid-row' style='background-color:#E60000;'> " . $customerEmail . " - " . $customerName . " <a class='customer-types-notes-link' href='' onclick='window.open( " . "\"" . $showNotesUrl . "\"" . "," . "\"" . $this->__('Notes') . "\"" . "," . "\"" . 'scrollbars=yes, resizable=yes, width=1000, height=300, top=150, left=200' . "\"" . "); return false;' target='_blank'>" . $this->__('(i)') . "</a>" . " </div>";
             }
             break;
     }
     return $html;
 }
Example #28
0
 public function render(Varien_Object $row)
 {
     $data = $row->getData();
     $formattedPrice = Mage::app()->getLocale()->currency($data["currency_code"])->toCurrency($row->getData($this->getColumn()->getIndex()) / 100);
     //$formattedPrice = Mage::helper('core')->currency(($row->getData($this->getColumn()->getIndex()) / 100), true, false);
     $value = $formattedPrice;
     return $value;
 }
Example #29
0
 public function render(Varien_Object $row)
 {
     if (!$row->getData($this->getColumn()->getIndex())) {
         return null;
     }
     return '<a title="' . Mage::helper('Mage_Core_Helper_Data')->__('Edit Store View') . '"
         href="' . $this->getUrl('*/*/editStore', array('store_id' => $row->getStoreId())) . '">' . $this->escapeHtml($row->getData($this->getColumn()->getIndex())) . '</a>';
 }
 /**
  * @param Varien_Object $object
  * @param string $table
  * @return array
  */
 protected function _prepareDataForTable(Varien_Object $object, $table)
 {
     if (is_array($object->getData('additional'))) {
         $object->setData('additional', Mage::helper('core')->jsonEncode($object->getData('additional')));
     }
     $data = parent::_prepareDataForTable($object, $table);
     return $data;
 }