예제 #1
0
파일: Product.php 프로젝트: quyip8818/Mag
 /**
  * Render product name to add Configure link
  *
  * @param   Varien_Object $row
  * @return  string
  */
 public function render(Varien_Object $row)
 {
     $rendered = parent::render($row);
     $isConfigurable = $row->canConfigure();
     $style = $isConfigurable ? '' : 'style="color: #CCC;"';
     $prodAttributes = $isConfigurable ? sprintf('list_type = "product_to_add" product_id = %s', $row->getId()) : 'disabled="disabled"';
     return sprintf('<a href="javascript:void(0)" %s class="f-right" %s>%s</a>', $style, $prodAttributes, Mage::helper('sales')->__('Configure')) . $rendered;
 }
예제 #2
0
파일: Zip.php 프로젝트: cnglobal-sl/caterez
 /**
  * Get value
  * 
  * @return string
  */
 public function _getValue(Varien_Object $row)
 {
     $value = parent::_getValue($row);
     if ($value === '') {
         return '*';
     } else {
         return $value;
     }
 }
예제 #3
0
 /**
  * Render product name to add Configure link
  *
  * @param   Varien_Object $row
  * @return  string
  */
 public function render(Varien_Object $row)
 {
     $rendered = parent::render($row);
     $link = '';
     if ($row->getProductType() == Mage_Catalog_Model_Product_Type::TYPE_BUNDLE) {
         $link = sprintf('<a href="javascript:void(0)" style="float: right;" class="product_to_add" id="productId_%s">%s</a>', $row->getId(), Mage::helper('enterprise_rma')->__('Select Items'));
     }
     return $rendered . $link;
 }
예제 #4
0
 /**
  * Render product name to add Configure link
  *
  * @param   Varien_Object $row
  * @return  string
  */
 public function render(Varien_Object $row)
 {
     $rendered = parent::render($row);
     $isConfigurable = $row->canConfigure();
     $product = Mage::getModel('catalog/product')->load($row->getId());
     $style = $isConfigurable ? '' : 'style="color: #CCC;"';
     $prodAttributes = $isConfigurable ? sprintf('product_type = "%s" list_type = "product_to_add" product_id = %s', count($product->getOptions()) > 0 ? 'customoptions' : $row->getTypeId(), $row->getId()) : 'disabled="disabled"';
     return sprintf('<a href="javascript:void(0)" %s class="f-right" %s>%s</a>', $style, $prodAttributes, Mage::helper('request4quote')->__('Configure')) . $rendered;
 }
예제 #5
0
 public function _getValue(Varien_Object $row)
 {
     $value = parent::_getValue($row);
     if ($row->getIsRequired()) {
         $value = '<div class="is_required_attribute">' . $value . ' *' . '</div>';
     } elseif (!$row->getMappingAttributeId()) {
         $value = '<div class="is_custom_attribute">' . $value . '</div>';
     }
     return $value;
 }
예제 #6
0
 /**
  * Render product name to add Configure link
  *
  * @param   Varien_Object $row
  * @return  string
  */
 public function render(Varien_Object $row)
 {
     $rendered = parent::render($row);
     $listType = $this->getColumn()->getGrid()->getListType();
     if ($row instanceof Mage_Catalog_Model_Product) {
         $product = $row;
     } else {
         if ($row instanceof Mage_Wishlist_Model_Item || $row instanceof Mage_Sales_Model_Order_Item) {
             $product = $row->getProduct();
         }
     }
     if ($product->canConfigure()) {
         $style = '';
         $prodAttributes = sprintf('list_type = "%s" item_id = %s', $listType, $row->getId());
     } else {
         $style = 'style="color: #CCC;"';
         $prodAttributes = 'disabled="disabled"';
     }
     return sprintf('<a href="javascript:void(0)" %s class="f-right" %s>%s</a>', $style, $prodAttributes, Mage::helper('sales')->__('Configure')) . $rendered;
 }
예제 #7
0
 /**
  * render the column
  *
  * @access public
  * @param Varien_Object $row
  * @return string
  * @author Ultimate Module Creator
  */
 public function render(Varien_Object $row)
 {
     $base = $this->getColumn()->getBaseLink();
     if (!$base) {
         return parent::render($row);
     }
     $paramsData = $this->getColumn()->getData('params');
     $params = array();
     if (is_array($paramsData)) {
         foreach ($paramsData as $name => $getter) {
             if (is_callable(array($row, $getter))) {
                 $params[$name] = call_user_func(array($row, $getter));
             }
         }
     }
     $staticParamsData = $this->getColumn()->getData('static');
     if (is_array($staticParamsData)) {
         foreach ($staticParamsData as $key => $value) {
             $params[$key] = $value;
         }
     }
     return '<a href="' . $this->getUrl($base, $params) . '" target="_blank">' . $this->_getValue($row) . '</a>';
 }
예제 #8
0
 /**
  * Renders grid column
  *
  * @param Varien_Object $row
  * @return mixed
  */
 public function _getValue(Varien_Object $row)
 {
     // If no format and it column not filtered specified return data as is.
     $_data = (int) parent::_getValue($row);
     $_string = is_null($_data) ? 0 : (int) $_data;
     $_w = floor($_string / 10080);
     $_d = floor(($_string - $_w * 10080) / 1440);
     $_h = floor(($_string - $_w * 10080 - $_d * 1440) / 60);
     $_m = $_string - $_w * 10080 - $_d * 1440 - $_h * 60;
     $_gridString = '';
     if ($_w) {
         $_gridString .= $_w . ' weeks ';
     }
     if ($_d) {
         $_gridString .= $_d . ' days ';
     }
     if ($_h) {
         $_gridString .= $_h . ' hours ';
     }
     if ($_m) {
         $_gridString .= $_m . ' minutes';
     }
     return $this->escapeHtml($_gridString);
 }
 /**
  * Prepares action data for html render
  *
  * @param array $action
  * @param string $actionCaption
  * @param Varien_Object $row
  * @return Mage_Adminhtml_Block_Widget_Grid_Column_Renderer_Action
  */
 protected function _transformActionData(&$action, &$actionCaption, Varien_Object $row)
 {
     foreach ($action as $attibute => $value) {
         if (isset($action[$attibute]) && !is_array($action[$attibute])) {
             $this->getColumn()->setFormat($action[$attibute]);
             $action[$attibute] = parent::render($row);
         } else {
             $this->getColumn()->setFormat(null);
         }
         switch ($attibute) {
             case 'caption':
                 $actionCaption = $action['caption'];
                 unset($action['caption']);
                 break;
             case 'url':
                 if (is_array($action['url'])) {
                     $params = array($action['field'] => $this->_getValue($row));
                     if (isset($action['url']['params'])) {
                         $params = array_merge($action['url']['params'], $params);
                     }
                     $action['href'] = $this->getUrl($action['url']['base'], $params);
                     unset($action['field']);
                 } else {
                     $action['href'] = $action['url'];
                 }
                 unset($action['url']);
                 break;
             case 'popup':
                 $action['onclick'] = 'popWin(this.href, \'windth=800,height=700,resizable=1,scrollbars=1\');return false;';
                 break;
         }
     }
     return $this;
 }
예제 #10
0
 /**
  * Render column for export
  *
  * @param Varien_Object $row
  * @return string
  */
 public function renderExport(Varien_Object $row)
 {
     $result = parent::renderExport($row);
     return strip_tags($result);
 }
예제 #11
0
 /**
  * Prepares action data for html render
  *
  * @param array $action
  * @param string $actionCaption
  * @param Varien_Object $row
  * @return Mage_Adminhtml_Block_Widget_Grid_Column_Renderer_Action
  */
 protected function _transformActionData(&$action, &$actionCaption, Varien_Object $row)
 {
     foreach ($action as $attibute => $value) {
         if (isset($action[$attibute]) && !is_array($action[$attibute])) {
             $this->getColumn()->setFormat($action[$attibute]);
             $action[$attibute] = parent::render($row);
         } else {
             $this->getColumn()->setFormat(null);
         }
         switch ($attibute) {
             case 'caption':
                 $actionCaption = $action['caption'];
                 unset($action['caption']);
                 break;
             case 'url':
                 if (is_array($action['url'])) {
                     $params = array($action['field'] => $this->_getValue($row));
                     if (isset($action['url']['params'])) {
                         $params = array_merge($action['url']['params'], $params);
                     }
                     $action['href'] = $this->getUrl($action['url']['base'], $params);
                     unset($action['field']);
                 } else {
                     $action['href'] = $action['url'];
                 }
                 unset($action['url']);
                 break;
         }
     }
     return $this;
 }