本文整理汇总了PHP中Varien_Object::getData方法的典型用法代码示例。如果您正苦于以下问题:PHP Varien_Object::getData方法的具体用法?PHP Varien_Object::getData怎么用?PHP Varien_Object::getData使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Varien_Object
的用法示例。
在下文中一共展示了Varien_Object::getData方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: beforeSave
/**
* 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;
}
示例2: render
/**
* 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;
}
示例3: _prepareCollection
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();
}
示例4: render
/**
* 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;
}
示例5: render
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');
}
示例6: getChanges
/**
* 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;
}
示例7: render
/**
* {@inheritdoc}
*/
public function render(Varien_Object $row)
{
if (!$row->getData('message_id')) {
return 'Unavailable';
}
return $row->getData('message_id');
}
示例8: render
public function render(Varien_Object $row)
{
if ($row->getData('total_inventory') || $row->getData('total_inventory') != null) {
return parent::render($row);
}
return $this->__('N/A');
}
示例9: _prepareArrayRow
/**
* 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"');
}
示例10: render
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;
}
}
示例11: _getValue
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;
}
示例12: render
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>';
}
示例13: render
/**
* {@inheritdoc}
*/
public function render(Varien_Object $row)
{
$total = $row->getData('successes');
$total += $row->getData('duplicates');
$total += $row->getData('failures');
return $total;
}
示例14: render
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;
}
示例15: _prepareForm
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);
}