本文整理汇总了PHP中Varien_Object::getCode方法的典型用法代码示例。如果您正苦于以下问题:PHP Varien_Object::getCode方法的具体用法?PHP Varien_Object::getCode怎么用?PHP Varien_Object::getCode使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Varien_Object
的用法示例。
在下文中一共展示了Varien_Object::getCode方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: render
public function render(Varien_Object $row)
{
$actions = array();
$curWebsite = $this->getRequest()->getParam('website');
$curStore = $this->getRequest()->getParam('store');
$aParams = array();
if ($curWebsite) {
$aParams['website'] = $curWebsite;
}
if ($curStore) {
$aParams['store'] = $curStore;
}
if (!$aParams) {
list($aParams['scope'], $aParams['scopeid']) = Mage::getModel('aitemails/aitemails')->getCurrentScope();
}
$aParams['fromaitemails'] = 1;
if ($row->getCustomTemplate()) {
$aParams['id'] = $row->getCustomTemplateId();
$actions[] = array('url' => $this->getUrl('adminhtml/system_email_template/edit', $aParams), 'caption' => $this->__('Edit Custom Template'));
} else {
$aParams['templatecode'] = $row->getCode();
$aParams['localecode'] = Mage::registry('aitemails_email_template_scope_locale');
$aParams['scope'] = $row->getScope();
$aParams['scopeid'] = $row->getScopeId();
$actions[] = array('url' => $this->getUrl('adminhtml/system_email_template/new', $aParams), 'caption' => $this->__('Create Custom Template'));
}
$this->getColumn()->setActions($actions);
return parent::render($row);
}
示例2: render
/**
* Renders qty column
*
* @param Varien_Object $row
* @return string
*/
public function render(Varien_Object $row)
{
$isDisabled = $row->getCode() == Enterprise_Checkout_Helper_Data::ADD_ITEM_STATUS_FAILED_SKU || $row->getIsConfigureDisabled() || $row->getIsQtyDisabled();
$html = '<input type="text" ';
$html .= 'name="' . $this->getColumn()->getId() . '" ';
$html .= 'value="' . $row->getData($this->getColumn()->getIndex()) . '" ';
$html .= $isDisabled ? 'disabled="disabled" ' : '';
$html .= 'class="input-text ' . $this->getColumn()->getInlineCss() . '"/>';
return $html;
}
示例3: logoutRedirect
/**
* Redirects to custom url after logout if set in system > configuration > customer > startup
*
* @param Varien_Event_Observer $observer
* @return $this
*/
public function logoutRedirect(Varien_Event_Observer $observer)
{
if (!Mage::getStoreConfigFlag('customer/startup/redirect_logout')) {
return $this;
}
$transportObj = new Varien_Object(array('url' => Mage::getStoreConfig('customer/startup/redirect_logout_url'), 'code' => 302));
Mage::dispatchEvent('ambimax_logoutredirect', array('data' => $transportObj));
/** @var Mage_Customer_AccountController $controller */
$controller = $observer->getControllerAction();
$controller->getResponse()->setRedirect($transportObj->getUrl(), $transportObj->getCode());
}
示例4: setRedirect
/**
* Additionally check for session messages in several domains case
*
* @param string $url
* @param int $code
* @return Mage_Core_Controller_Response_Http
*/
public function setRedirect($url, $code = 302)
{
/**
* Use single transport object instance
*/
if (self::$_transportObject === null) {
self::$_transportObject = new Varien_Object();
}
self::$_transportObject->setUrl($url);
self::$_transportObject->setCode($code);
Mage::dispatchEvent('controller_response_redirect', array('response' => $this, 'transport' => self::$_transportObject));
return parent::setRedirect(self::$_transportObject->getUrl(), self::$_transportObject->getCode());
}
示例5: render
/**
* Renders grid column
*
* @param Varien_Object $row
* @return string
*/
public function render(Varien_Object $row)
{
$links = array();
if ($row->getChangelog()) {
$links[] = sprintf('<a href="javascript:void(0)" onclick="%s">%s</a><div style="display:none" class="changelog"><div class="title">%s</div><div class="content">%s</div></div>', "tmcoreWindow.update(this.next('.changelog').down('.content').innerHTML, this.next('.changelog').down('.title').innerHTML).show()", Mage::helper('tmcore')->__('Changelog'), strip_tags($row->getCode()), nl2br(htmlspecialchars($row->getChangelog())));
}
if ($row->getDownloadLink()) {
$links[] = sprintf('<a href="%s" title="%s" onclick="window.open(this.href); return false;">%s</a>', $row->getDownloadLink(), Mage::helper('tmcore')->__('Download Latest Version'), Mage::helper('tmcore')->__('Download'));
}
if ($row->hasUpgradesDir() || $row->getIdentityKeyLink()) {
$links[] = sprintf('<a href="%s">%s</a>', $this->getUrl('*/*/manage/', array('_current' => true, 'id' => $row->getId())), Mage::helper('tmcore')->__('Manage'));
}
return implode(' | ', $links);
}
示例6: getActiveMethodRate
public function getActiveMethodRate()
{
if ($this->getCustomMethodCode() == $this->getOrder()->getShippingMethod()) {
$rate = new Varien_Object();
$rate->setCode($this->getCustomMethodCode());
$rate->setPrice($this->getOrder()->getShippingAmount());
$rate->setMethodTitle(Mage::helper('iwd_ordermanager')->__("Custom"));
$rate->setMethodDescription($this->getOrder()->getShippingDescription());
return $rate;
}
if (is_array($this->shipping_rates)) {
foreach ($this->shipping_rates as $group) {
foreach ($group as $code => $rate) {
if ($rate->getCode() == $this->getOrder()->getShippingMethod()) {
return $rate;
}
}
}
}
return false;
}
示例7: getShippingRates
public function getShippingRates($order)
{
$request = $this->prepareShippingRequest($order);
$shipping = Mage::getModel('shipping/shipping');
$result = $shipping->collectRates($request)->getResult();
if ($result) {
$rates = array();
foreach ($result->getAllRates() as $_rate) {
$rate = new Varien_Object();
$rate->setData($_rate->getData());
$carrier = $rate->getCarrier();
if (!isset($rates[$carrier])) {
$rates[$carrier] = array();
}
$rate->setCode($carrier . '_' . $rate->getMethod());
$rates[$carrier][$rate->getCode()] = $rate;
}
return $rates;
}
return null;
}
示例8: _prepareForm
protected function _prepareForm()
{
$form = new Varien_Data_Form();
$this->setForm($form);
$fieldset = $form->addFieldset('feedback_form', array('legend' => Mage::helper('magenotification')->__('Feedback detail')));
$data = array();
if (Mage::getSingleton('adminhtml/session')->getFeedbackData()) {
$data = Mage::getSingleton('adminhtml/session')->getFeedbackData();
Mage::getSingleton('adminhtml/session')->setFeedbackData(null);
} elseif (Mage::registry('feedback_data')) {
$data = Mage::registry('feedback_data')->getData();
}
$dataObject = new Varien_Object($data);
if ($dataObject->getFeedbackId()) {
$fieldset->addField('is_sent', 'note', array('label' => '', 'name' => 'is_sent', 'text' => $dataObject->getIsSent() == '1' ? '<span style="width:250px;" class="grid-severity-notice"><span>' . $this->__('Sent to Magestore.com') . '</span></span>' : '<span style="width:250px;" class="grid-severity-critical"><span>' . $this->__('Not sent to Magestore.com') . '</span></span>'));
}
if ($dataObject->getFeedbackId()) {
$fieldset->addField('code', 'note', array('label' => Mage::helper('magenotification')->__('Feedback Code'), 'name' => 'code', 'text' => $dataObject->getCode()));
$fieldset->addField('extension', 'note', array('label' => Mage::helper('magenotification')->__('Extension'), 'name' => 'extension', 'text' => $dataObject->getExtension() . ' - version ' . $dataObject->getExtensionVersion()));
} else {
$fieldset->addField('extension', 'select', array('label' => Mage::helper('magenotification')->__('Extension'), 'name' => 'extension', 'values' => Mage::helper('magenotification')->getExtensionOption(), 'class' => 'required-entry', 'required' => true));
}
if ($dataObject->getFeedbackId()) {
$fieldset->addField('created_time', 'note', array('label' => Mage::helper('magenotification')->__('Posted'), 'name' => 'created_time', 'text' => $this->formatDate($dataObject->getCreatedTime(), 'medium', true)));
if ($dataObject->getCouponCode()) {
$fieldset->addField('coupon_code', 'note', array('label' => Mage::helper('magenotification')->__('Coupon'), 'name' => 'coupon_code', 'text' => '<b>' . $dataObject->getCouponCode() . '</b> (' . Mage::helper('magenotification')->__('for discount') . ' ' . $dataObject->getCouponValue() . ' ' . Mage::helper('magenotification')->__('to') . ' ' . Mage::helper('core')->formatDate($dataObject->getExpiredCoupon(), 'medium', false) . ')'));
}
$fieldset->addField('status', 'select', array('label' => Mage::helper('magenotification')->__('Status'), 'name' => 'status', 'values' => Mage::helper('magenotification')->getFeedbackStatusOption(), 'disabled' => 'disabled', 'style' => 'width:600px;'));
$fieldset->addField('content', 'note', array('name' => 'content', 'label' => Mage::helper('magenotification')->__('Feedback'), 'text' => $dataObject->getData('content')));
$fieldset->addField('attached_file', 'note', array('name' => 'attached_file', 'label' => Mage::helper('magenotification')->__('Attached Files'), 'text' => $this->getLayout()->createBlock('magenotification/adminhtml_feedback_renderer_file')->setFeedback($dataObject)->getAttachedFilesHtml()));
} else {
$fieldset->addField('content', 'editor', array('name' => 'content', 'label' => Mage::helper('magenotification')->__('Feedback'), 'style' => 'width:600px;height:300px', 'class' => 'required-entry', 'required' => true));
$fieldset->addField('attached_file', 'note', array('name' => 'attached_file', 'label' => Mage::helper('magenotification')->__('Attached Files'), 'text' => $this->getLayout()->createBlock('magenotification/adminhtml_feedback_renderer_file')->toHtml()));
}
$form->setValues($data);
return parent::_prepareForm();
}
示例9: _addTotalToXmlApi23
/**
* Add total to totals XML. Api version 23.
*
* @param Varien_Object $total
* @param Mage_XmlConnect_Model_Simplexml_Element $totalsXml
* @return null
*/
protected function _addTotalToXmlApi23($total, Mage_XmlConnect_Model_Simplexml_Element $totalsXml)
{
if ($total instanceof Varien_Object && $total->getCode() && $total->getLabel() && $total->hasData('value')) {
$totalsXml->addCustomChild('item', $this->_formatPrice($total), array('id' => preg_replace('@[\\W]+@', '_', trim($total->getCode())), 'label' => $totalsXml->escapeXml($total->getLabel())));
}
}
示例10: renderShippingRateValue
/**
* Get either shipping rate code or empty value on error
*
* @param Varien_Object $rate
* @return string
*/
public function renderShippingRateValue(Varien_Object $rate)
{
if ($rate->getErrorMessage()) {
return '';
}
return $rate->getCode();
}
示例11: _getItemId
/**
* Force standard function as we want to use action code as id
*
* @param Varien_Object $item collection item
*
* @return mixed
*/
protected function _getItemId(Varien_Object $item)
{
return $item->getCode();
}
示例12: updateQtyOption
/**
* Method is needed for specific actions to change given quote options values
* according current product type logic
* Example: the cataloginventory validation of decimal qty can change qty to int,
* so need to change quote item qty option value too.
*
* @param array $options
* @param Varien_Object $option
* @param mixed $value
*
* @return object Mage_Bundle_Model_Product_Type
*/
public function updateQtyOption($options, Varien_Object $option, $value)
{
$optionProduct = $option->getProduct();
$optionCollection = $this->getOptionsCollection();
$selections = $this->getSelectionsCollection($optionCollection->getAllIds());
foreach ($selections as $selection) {
if ($selection->getProductId() == $optionProduct->getId()) {
foreach ($options as &$option) {
if ($option->getCode() == 'selection_qty_' . $selection->getSelectionId()) {
$option->setValue($value);
}
}
}
}
return $this;
}
示例13: _addTotalToXml
/**
* Add total to totals XML
*
* @param Varien_Object $total
* @param Mage_XmlConnect_Model_Simplexml_Element $totalsXml
* @return null
*/
private function _addTotalToXml($total, Mage_XmlConnect_Model_Simplexml_Element $totalsXml)
{
if ($total instanceof Varien_Object && $total->getCode() && $total->getLabel() && $total->hasData('value')) {
$totalsXml->addCustomChild(preg_replace('@[\\W]+@', '_', trim($total->getCode())), $this->_formatPrice($total), array('label' => strip_tags($total->getLabel())));
}
}
示例14: getMessageByItem
/**
* Retrieve error message for the item
*
* @param Varien_Object $item
* @return string
*/
public function getMessageByItem(Varien_Object $item)
{
$message = $this->getMessage($item->getCode());
return $message ? $message : $item->getError();
}
示例15: updateQtyOption
/**
* Method is needed for specific actions to change given quote options values
* according current product type logic
* Example: the cataloginventory validation of decimal qty can change qty to int,
* so need to change quote item qty option value too.
*
* @param array $options
* @param Varien_Object $option
* @param mixed $value
* @param Mage_Catalog_Model_Product $product
* @return Mage_Bundle_Model_Product_Type
*/
public function updateQtyOption($options, Varien_Object $option, $value, $product = null)
{
$optionProduct = $option->getProduct($product);
$optionUpdateFlag = $option->getHasQtyOptionUpdate();
$optionCollection = $this->getOptionsCollection($product);
$selections = $this->getSelectionsCollection($optionCollection->getAllIds(), $product);
foreach ($selections as $selection) {
if ($selection->getProductId() == $optionProduct->getId()) {
foreach ($options as &$option) {
if ($option->getCode() == 'selection_qty_' . $selection->getSelectionId()) {
if ($optionUpdateFlag) {
$option->setValue(intval($option->getValue()));
} else {
$option->setValue($value);
}
}
}
}
}
return $this;
}