本文整理汇总了PHP中Varien_Object::getDescription方法的典型用法代码示例。如果您正苦于以下问题:PHP Varien_Object::getDescription方法的具体用法?PHP Varien_Object::getDescription怎么用?PHP Varien_Object::getDescription使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Varien_Object
的用法示例。
在下文中一共展示了Varien_Object::getDescription方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: render
public function render(Varien_Object $row)
{
$title = $row->getTitle();
if ($row->getDescription()) {
$title .= '<br><small>' . $row->getDescription() . '</small>';
}
return $title;
}
示例2: render
/**
* Renders grid column
*
* @param Varien_Object $row
* @return string
*/
public function render(Varien_Object $row)
{
$dots = '';
if (strlen($row->getDescription()) > 512) {
$dots = ' . . . ';
}
return '<span class="grid-row-title">' . $row->getTitle() . '</span>' . ($row->getDescription() ? '<br />' . substr($row->getDescription(), 0, 512) . $dots : '');
}
示例3: _getItemsXml
/**
* Retrieve quote items in XML format
*
* @return string
*/
protected function _getItemsXml()
{
$xml = <<<EOT
<items>
EOT;
foreach ($this->getQuote()->getAllItems() as $item) {
if ($item->getParentItem()) {
continue;
}
$taxClass = $item->getTaxClassId() == 0 ? 'none' : $item->getTaxClassId();
$weight = (double) $item->getWeight();
$weightUnit = self::ITEM_WEIGHT_UNIT;
$unitPrice = $item->getBaseCalculationPrice();
if (Mage::helper('Mage_Weee_Helper_Data')->includeInSubtotal()) {
$unitPrice += $item->getBaseWeeeTaxAppliedAmount();
}
$xml .= <<<EOT
<item>
<merchant-item-id><![CDATA[{$item->getSku()}]]></merchant-item-id>
<item-name><![CDATA[{$item->getName()}]]></item-name>
<item-description><![CDATA[{$item->getDescription()}]]></item-description>
<unit-price currency="{$this->getCurrency()}">{$unitPrice}</unit-price>
<quantity>{$item->getQty()}</quantity>
<item-weight unit="{$weightUnit}" value="{$weight}" />
<tax-table-selector>{$taxClass}</tax-table-selector>
{$this->_getDigitalContentXml($item->getIsVirtual())}
{$this->_getMerchantPrivateItemDataXml($item)}
</item>
EOT;
}
$billingAddress = $this->getQuote()->getBillingAddress();
$shippingAddress = $this->getQuote()->getShippingAddress();
$shippingDiscount = (double) $shippingAddress->getBaseDiscountAmount();
$billingDiscount = (double) $billingAddress->getBaseDiscountAmount();
$discount = $billingDiscount + $shippingDiscount;
// Exclude shipping discount
// Discount is negative value
$discount += $shippingAddress->getBaseShippingDiscountAmount();
$discountItem = new Varien_Object(array('price' => $discount, 'name' => $this->__('Cart Discount'), 'description' => $this->__('A virtual item to reflect the discount total')));
Mage::dispatchEvent('google_checkout_discount_item_price', array('quote' => $this->getQuote(), 'discount_item' => $discountItem));
$discount = $discountItem->getPrice();
if ($discount) {
$xml .= <<<EOT
<item>
<merchant-item-id>_INTERNAL_DISCOUNT_</merchant-item-id>
<item-name>{$discountItem->getName()}</item-name>
<item-description>{$discountItem->getDescription()}</item-description>
<unit-price currency="{$this->getCurrency()}">{$discount}</unit-price>
<quantity>1</quantity>
<item-weight unit="{$weightUnit}" value="0.00" />
<tax-table-selector>none</tax-table-selector>
{$this->_getDigitalContentXml($this->getQuote()->isVirtual())}
</item>
EOT;
}
$hiddenTax = $shippingAddress->getBaseHiddenTaxAmount() + $billingAddress->getBaseHiddenTaxAmount();
if ($hiddenTax) {
$xml .= <<<EOT
<item>
<merchant-item-id>_INTERNAL_TAX_</merchant-item-id>
<item-name>{$this->__('Discount Tax')}</item-name>
<item-description>{$this->__('A virtual item to reflect the tax total')}</item-description>
<unit-price currency="{$this->getCurrency()}">{$hiddenTax}</unit-price>
<quantity>1</quantity>
<item-weight unit="{$weightUnit}" value="0.00" />
<tax-table-selector>none</tax-table-selector>
{$this->_getDigitalContentXml($this->getQuote()->isVirtual())}
</item>
EOT;
}
$xml .= <<<EOT
</items>
EOT;
return $xml;
}
示例4: render
/**
* Truncates a string at the specified length.
* Append " ..." if string is longer then the specified length.
*
* @param Varien_Object $object
*
* @return string
*/
public function render(Varien_Object $object)
{
$description = strtok(wordwrap($object->getDescription(), 30, ' ...\\n'), '\\n');
return $description;
}
示例5: _addField
/**
* Add field to Options form based on parameter configuration
*
* @param Varien_Object $parameter
* @return Varien_Data_Form_Element_Abstract
*/
protected function _addField($parameter)
{
$form = $this->getForm();
$fieldset = $this->getMainFieldset();
//$form->getElement('options_fieldset');
// prepare element data with values (either from request of from default values)
$fieldName = $parameter->getKey();
$data = array('name' => $form->addSuffixToName($fieldName, 'parameters'), 'label' => $this->_translationHelper->__($parameter->getLabel()), 'required' => $parameter->getRequired(), 'class' => 'widget-option', 'note' => $this->_translationHelper->__($parameter->getDescription()));
if ($values = $this->getWidgetValues()) {
$data['value'] = isset($values[$fieldName]) ? $values[$fieldName] : '';
} else {
$data['value'] = $parameter->getValue();
//prepare unique id value
if ($fieldName == 'unique_id' && $data['value'] == '') {
$data['value'] = md5(microtime(1));
}
}
// prepare element dropdown values
if ($values = $parameter->getValues()) {
// dropdown options are specified in configuration
$data['values'] = array();
foreach ($values as $option) {
$data['values'][] = array('label' => $this->_translationHelper->__($option['label']), 'value' => $option['value']);
}
} elseif ($sourceModel = $parameter->getSourceModel()) {
$data['values'] = Mage::getModel($sourceModel)->toOptionArray();
}
// prepare field type or renderer
$fieldRenderer = null;
$fieldType = $parameter->getType();
// hidden element
if (!$parameter->getVisible()) {
$fieldType = 'hidden';
} elseif (false !== strpos($fieldType, '/')) {
$fieldRenderer = $this->getLayout()->createBlock($fieldType);
$fieldType = $this->_defaultElementType;
}
// instantiate field and render html
$field = $fieldset->addField($this->getMainFieldsetHtmlId() . '_' . $fieldName, $fieldType, $data);
if ($fieldRenderer) {
$field->setRenderer($fieldRenderer);
}
// extra html preparations
if ($helper = $parameter->getHelperBlock()) {
$helperBlock = $this->getLayout()->createBlock($helper->getType(), '', $helper->getData());
if ($helperBlock instanceof Varien_Object) {
$helperBlock->setConfig($helper->getData())->setFieldsetId($fieldset->getId())->setTranslationHelper($this->_translationHelper)->prepareElementHtml($field);
}
}
// dependencies from other fields
$dependenceBlock = $this->getChild('form_after');
$dependenceBlock->addFieldMap($field->getId(), $fieldName);
if ($parameter->getDepends()) {
foreach ($parameter->getDepends() as $from => $row) {
$values = isset($row['values']) ? array_values($row['values']) : (string) $row['value'];
$dependenceBlock->addFieldDependence($fieldName, $from, $values);
}
}
return $field;
}
示例6: _parseItemDescription
/**
* Parse item description
*
* @param Varien_Object $item
* @return array
*/
protected function _parseItemDescription($item)
{
$matches = array();
$description = $item->getDescription();
if (preg_match_all('/<li.*?>(.*?)<\\/li>/i', $description, $matches)) {
return $matches[1];
}
return array($description);
}
示例7: _checkoutRecurring
/**
* charge money for recurring item
*/
protected function _checkoutRecurring()
{
/** @var Mage_Sales_Model_Order $order */
$order = Mage::getModel('sales/order');
$item = new Varien_Object($this->_recurringProfile->getOrderItemInfo());
$this->_price = $item->getBasePrice() * $item->getQty();
$additionalInfo = $this->_recurringProfile->getAdditionalInfo();
// check isset TrialBilling
// Trial Billing Frequency <= 0 or isn't numeric => failure
if ($this->_recurringProfile->getTrialBillingAmount() && $this->_recurringProfile->getTrialPeriodFrequency() && $this->_recurringProfile->getTrialPeriodMaxCycles() && $this->_recurringProfile->getTrialPeriodUnit() && (string) (int) $this->_recurringProfile->getTrialPeriodFrequency() === ltrim($this->_recurringProfile->getTrialPeriodFrequency(), '0') && (int) $this->_recurringProfile->getTrialPeriodFrequency() > 0) {
$trialPeriodMaxCycles = (int) $this->_recurringProfile->getTrialPeriodMaxCycles();
if (!isset($additionalInfo['trialPeriodMaxCycles'])) {
$additionalInfo['trialPeriodMaxCycles'] = $trialPeriodMaxCycles;
$this->_recurringProfile->setAdditionalInfo($additionalInfo);
$this->_price = $this->_recurringProfile->getTrialBillingAmount();
$this->_periodType = Mage_Sales_Model_Recurring_Profile::PAYMENT_TYPE_TRIAL;
} elseif (isset($additionalInfo['trialPeriodMaxCycles']) && $additionalInfo['trialPeriodMaxCycles'] > 0) {
$this->_price = $this->_recurringProfile->getTrialBillingAmount();
$this->_periodType = Mage_Sales_Model_Recurring_Profile::PAYMENT_TYPE_TRIAL;
}
}
// calculate total amount
$this->_shippingAmount = $item->getBaseShippingAmount();
$this->_taxAmount = $item->getBaseTaxAmount();
$this->_amount = $this->_price + $this->_shippingAmount + $this->_taxAmount;
// init order
/** @var Mage_Sales_Model_Order_Item $orderItem */
$orderItem = Mage::getModel('sales/order_item')->setName($item->getName())->setSku($item->getSku())->setDescription($item->getDescription())->setQtyOrdered($item->getQty())->setBasePrice($item->getBasePrice())->setBaseTaxAmount($item->getBaseTaxAmount())->setBaseRowTotalInclTax($item->getBaseRowTotalInclTax());
$order->addItem($orderItem);
$shippingInfo = $this->_recurringProfile->getShippingAddressInfo();
$shippingAddress = Mage::getModel('sales/order_address')->setData($shippingInfo)->setId(null);
// get base currency code
$orderInfo = new Varien_Object($this->_recurringProfile->getOrderInfo());
$currencyCode = $orderInfo->getBaseCurrencyCode();
$order->setShippingAddress($shippingAddress);
$order->setBaseCurrencyCode($currencyCode);
/** @var Mage_Sales_Model_Order_Payment $payment */
$payment = Mage::getModel('sales/order_payment');
$payment->setOrder($order);
$payment->setIsRecurring(true);
$payment->setIsInitialFee(true);
$customerId = $this->_recurringProfile->getCustomerId();
$payment->setCustomerId($customerId);
$tokenId = $additionalInfo['token']['saved_token'];
$payment->setTokenId($tokenId);
/** @var Eway_Rapid31_Model_Method_Saved $ewaySave */
$ewaySave = Mage::getModel('ewayrapid/method_saved');
$paymentAction = Mage::getStoreConfig('payment/ewayrapid_general/payment_action');
if ($paymentAction == Mage_Payment_Model_Method_Abstract::ACTION_AUTHORIZE) {
$ewaySave->authorize($payment, $this->_amount);
} elseif ($paymentAction == Mage_Payment_Model_Method_Abstract::ACTION_AUTHORIZE_CAPTURE) {
$ewaySave->capture($payment, $this->_amount);
}
if (!$payment->getTransactionId()) {
throw new Exception('Transaction is not available');
} else {
$this->_txdId = $payment->getTransactionId();
}
/** @todo: change status of order = "eWAY Authorised"
* now status order = "processing"
*/
}
示例8: getConfigAsObject
public function getConfigAsObject($code)
{
$xml = $this->getConfigAsXml($code);
$object = new Varien_Object();
if ($xml === null) {
return $object;
}
// Save all nodes to object data
$object->setCode($code);
$object->setData($xml->asCanonicalArray());
// Set module for translations etc..
$module = $object->getData('@/module');
$object->setModule($module ? $module : 'customgrid');
// Set type
$type = $object->getData('@/type');
$object->setType($type);
// Translate name, description and help
$helper = Mage::helper($object->getModule());
if ($object->hasName()) {
$object->setName($helper->__((string) $object->getName()));
}
if ($object->hasDescription()) {
$object->setDescription($helper->__((string) $object->getDescription()));
}
if ($object->hasHelp()) {
$object->setHelp($helper->__((string) $object->getHelp()));
}
if ($this->_acceptParameters) {
// Correct element parameters and convert its data to objects if needed
$params = $object->getData('parameters');
$newParams = array();
if (is_array($params)) {
$sortOrder = 0;
foreach ($params as $key => $data) {
if (is_array($data)) {
$data['key'] = $key;
$data['sort_order'] = isset($data['sort_order']) ? (int) $data['sort_order'] : $sortOrder;
// Prepare values (for dropdowns) specified directly in configuration
$values = array();
if (isset($data['values']) && is_array($data['values'])) {
foreach ($data['values'] as $value) {
if (isset($value['label']) && isset($value['value'])) {
$values[] = $value;
}
}
}
$data['values'] = $values;
// Prepare helper block object
if (isset($data['helper_block'])) {
$helper = new Varien_Object();
if (isset($data['helper_block']['data']) && is_array($data['helper_block']['data'])) {
$helper->addData($data['helper_block']['data']);
}
if (isset($data['helper_block']['type'])) {
$helper->setType($data['helper_block']['type']);
}
$data['helper_block'] = $helper;
}
$newParams[$key] = new Varien_Object($data);
$sortOrder++;
}
}
}
uasort($newParams, array($this, '_sortParameters'));
$object->setData('parameters', $newParams);
}
return $object;
}
示例9: getOptionValues
public function getOptionValues()
{
$data = array();
$optionsArr = '';
$data = $this->getTemplateData();
if (isset($data['hash_options'])) {
$optionsArr = $data['hash_options'];
}
$zendDate = new Zend_Date();
$dateFormat = Mage::app()->getLocale()->getDateFormat(Mage_Core_Model_Locale::FORMAT_TYPE_SHORT);
$helper = Mage::helper('customoptions');
$helper->getCustomerGroups();
// init customer_groups for sort prices
$groupId = (int) $this->getRequest()->getParam('group_id');
if ($optionsArr) {
$optionsArr = unserialize($optionsArr);
}
$store = Mage::app()->getStore($this->getStoreId());
$storeOptionsArr = array();
$groupStore = Mage::getSingleton('customoptions/group_store')->loadByGroupAndStore($groupId, $this->getStoreId());
if ($groupStore->getHashOptions()) {
$storeOptionsArr = unserialize($groupStore->getHashOptions());
}
//print_r($storeOptionsArr); exit;
$optionModel = Mage::getSingleton('catalog/product_option');
if (!$this->_values && $optionsArr) {
$values = array();
$sortOrder = array();
$scope = (int) Mage::app()->getStore()->getConfig(Mage_Core_Model_Store::XML_PATH_PRICE_SCOPE);
$optionItemCount = count($optionsArr);
foreach ($optionsArr as $optionId => $option) {
$option = new Varien_Object($option);
$value = array();
if ($option->getIsDelete() != '1') {
$value['id'] = $option->getOptionId();
$value['item_count'] = $optionItemCount;
$value['option_id'] = $option->getOptionId();
$value['title'] = $this->htmlEscape(isset($storeOptionsArr[$optionId]['title']) ? $storeOptionsArr[$optionId]['title'] : $option->getTitle());
// old view_mode = hidden => to new type = 'hidden';
if ($optionModel->getGroupByType($option->getType()) == Mage_Catalog_Model_Product_Option::OPTION_GROUP_SELECT && $option->getViewMode() == 2) {
$option->setType('hidden');
$option->setViewMode(1);
}
$value['type'] = $option->getType();
$value['is_require'] = $option->getIsRequire();
$value['view_mode'] = isset($storeOptionsArr[$optionId]['view_mode']) ? $storeOptionsArr[$optionId]['view_mode'] : $option->getViewMode();
$value['is_dependent'] = $option->getIsDependent();
$value['div_class'] = $option->getDivClass();
$value['sku_policy'] = $option->getSkuPolicy();
$value['customoptions_is_onetime'] = $option->getCustomoptionsIsOnetime();
$value['qnty_input'] = $option->getQntyInput() ? 'checked' : '';
$value['qnty_input_disabled'] = $option->getType() == 'multiple' || $option->getType() == 'hidden' ? 'disabled' : '';
$value['image_mode'] = $option->getImageMode();
$value['image_mode_disabled'] = $optionModel->getGroupByType($option->getType()) != Mage_Catalog_Model_Product_Option::OPTION_GROUP_SELECT ? 'disabled' : '';
$value['exclude_first_image'] = $option->getExcludeFirstImage() ? 'checked' : '';
$value['description'] = $this->htmlEscape(isset($storeOptionsArr[$optionId]['description']) ? $storeOptionsArr[$optionId]['description'] : $option->getDescription());
if ($helper->isCustomerGroupsEnabled() && $option->getCustomerGroups() != null) {
$value['customer_groups'] = implode(',', $option->getCustomerGroups());
}
if ($helper->isStoreViewsEnabled() && $option->getStoreViews() != null) {
$value['store_views'] = implode(',', $option->getStoreViews());
}
$value['in_group_id'] = $option->getInGroupId();
$value['in_group_id_view'] = $option->getInGroupId();
$value['sort_order'] = $this->_getSortOrder($option);
if ($this->getStoreId() != '0') {
$value['checkboxScopeTitle'] = $this->getCheckboxScopeHtml($option->getOptionId(), 'title', !isset($storeOptionsArr[$optionId]['title']));
$value['scopeTitleDisabled'] = !isset($storeOptionsArr[$optionId]['title']) ? 'disabled' : null;
$value['checkboxScopeViewMode'] = $this->getCheckboxScopeHtml($option->getOptionId(), 'view_mode', !isset($storeOptionsArr[$optionId]['view_mode']));
$value['scopeViewModeDisabled'] = !isset($storeOptionsArr[$optionId]['view_mode']) ? 'disabled' : null;
$value['checkboxScopeDescription'] = $this->getCheckboxScopeHtml($option->getOptionId(), 'description', !isset($storeOptionsArr[$optionId]['description']));
$value['scopeDescriptionDisabled'] = !isset($storeOptionsArr[$optionId]['description']) ? 'disabled' : null;
}
if ($optionModel->getGroupByType($option->getType()) == Mage_Catalog_Model_Product_Option::OPTION_GROUP_SELECT) {
$countValues = count($option->getValues());
if ($countValues > 0) {
foreach ($option->getValues() as $key => $_value) {
$_value = new Varien_Object($_value);
$_value->setOptionTypeId($key);
if ($_value->getIsDelete() != '1') {
$defaultArray = $option->getDefault() !== null ? $option->getDefault() : array();
if (isset($storeOptionsArr[$optionId]['values'][$_value->getOptionTypeId()]['price'])) {
$_value->setPrice(floatval($storeOptionsArr[$optionId]['values'][$_value->getOptionTypeId()]['price']));
}
if (isset($storeOptionsArr[$optionId]['values'][$_value->getOptionTypeId()]['price_type'])) {
$_value->setPriceType($storeOptionsArr[$optionId]['values'][$_value->getOptionTypeId()]['price_type']);
}
// for support old format:
if (isset($storeOptionsArr[$optionId]['values'][$_value->getOptionTypeId()]['special_price'])) {
$_value->setSpecialPrice(floatval($storeOptionsArr[$optionId]['values'][$_value->getOptionTypeId()]['special_price']));
}
if (isset($storeOptionsArr[$optionId]['values'][$_value->getOptionTypeId()]['special_comment'])) {
$_value->setSpecialComment($storeOptionsArr[$optionId]['values'][$_value->getOptionTypeId()]['special_comment']);
}
if ($_value->getSpecialPrice()) {
$_value->setSpecials(array(array('customer_group_id' => 32000, 'price' => $_value->getSpecialPrice(), 'price_type' => 'fixed', 'comment' => $_value->getSpecialComment(), 'date_from' => '', 'date_to' => '')));
}
$helper->applyLinkedBySkuDataToOption($_value, $_value->getSku(), $store, 0);
$helper->calculateOptionSpecialPrice($_value, null, $helper->isSpecialPriceEnabled());
$priceDisabled = $_value->getIsSkuPrice();
//.........这里部分代码省略.........
示例10: getOptionValues
public function getOptionValues()
{
$data = array();
$optionsArr = '';
$session = Mage::getSingleton('adminhtml/session');
if ($data = $session->getData('customoptions_data')) {
if (isset($data['general']['hash_options'])) {
$optionsArr = $data['general']['hash_options'];
}
} elseif (Mage::registry('customoptions_data')) {
$data = Mage::registry('customoptions_data')->getData();
if (isset($data['hash_options'])) {
$optionsArr = $data['hash_options'];
}
}
$groupId = (int) $this->getRequest()->getParam('group_id');
if ($optionsArr) {
$optionsArr = unserialize($optionsArr);
}
$storeOptionsArr = array();
$groupStore = Mage::getSingleton('customoptions/group_store')->loadByGroupAndStore($groupId, $this->getStoreId());
if ($groupStore->getHashOptions()) {
$storeOptionsArr = unserialize($groupStore->getHashOptions());
}
$product = Mage::getSingleton('catalog/product_option');
if (!$this->_values && $optionsArr) {
$values = array();
$sortOrder = array();
$scope = (int) Mage::app()->getStore()->getConfig(Mage_Core_Model_Store::XML_PATH_PRICE_SCOPE);
$optionItemCount = count($optionsArr);
foreach ($optionsArr as $optionId => $option) {
$option = new Varien_Object($option);
$value = array();
if ($option->getIsDelete() != '1') {
$value['id'] = $option->getOptionId();
$value['item_count'] = $optionItemCount;
$value['option_id'] = $option->getOptionId();
$value['title'] = $this->htmlEscape(isset($storeOptionsArr[$optionId]['title']) ? $storeOptionsArr[$optionId]['title'] : $option->getTitle());
$value['type'] = $option->getType();
$value['is_require'] = $option->getIsRequire();
$value['is_enabled'] = $option->getIsEnabled();
$value['is_dependent'] = $option->getIsDependent();
$value['code'] = $this->htmlEscape($option->getCode());
$value['option_code'] = $option->getOptionCode();
$value['customoptions_is_onetime'] = $option->getCustomoptionsIsOnetime();
$value['qnty_input'] = $option->getQntyInput() ? 'checked' : '';
$value['qnty_input_disabled'] = $option->getType() == 'drop_down' || $option->getType() == 'radio' || $option->getType() == 'checkbox' ? '' : 'disabled';
$value['description'] = $this->htmlEscape(isset($storeOptionsArr[$optionId]['description']) ? $storeOptionsArr[$optionId]['description'] : $option->getDescription());
$value['block_title'] = $this->htmlEscape(isset($storeOptionsArr[$optionId]['block_title']) ? $storeOptionsArr[$optionId]['block_title'] : $option->getBlockTitle());
if (Mage::helper('customoptions')->isCustomerGroupsEnabled() && $option->getCustomerGroups() != null) {
$value['customer_groups'] = implode(',', $option->getCustomerGroups());
}
$value['in_group_id'] = $option->getInGroupId();
$value['in_group_id_view'] = $option->getInGroupId();
$value['sort_order'] = $this->_getSortOrder($option);
if ($this->getStoreId() != '0') {
$value['checkboxScopeTitle'] = $this->getCheckboxScopeHtml($option->getOptionId(), 'title', !isset($storeOptionsArr[$optionId]['title']));
$value['scopeTitleDisabled'] = !isset($storeOptionsArr[$optionId]['title']) ? 'disabled' : null;
$value['checkboxScopeDescription'] = $this->getCheckboxScopeHtml($option->getOptionId(), 'description', !isset($storeOptionsArr[$optionId]['description']));
$value['scopeDescriptionDisabled'] = !isset($storeOptionsArr[$optionId]['description']) ? 'disabled' : null;
$value['checkboxScopeBlockTitle'] = $this->getCheckboxScopeHtml($option->getOptionId(), 'block_title', !isset($storeOptionsArr[$optionId]['block_title']));
$value['scopeBlockTitleDisabled'] = !isset($storeOptionsArr[$optionId]['block_title']) ? 'disabled' : null;
}
if ($product->getGroupByType($option->getType()) == Mage_Catalog_Model_Product_Option::OPTION_GROUP_SELECT) {
$countValues = count($option->getValues());
if ($countValues > 0) {
foreach ($option->getValues() as $key => $_value) {
$_value = new Varien_Object($_value);
$_value->setOptionTypeId($key);
if ($_value->getIsDelete() != '1') {
$defaultArray = $option->getDefault() !== null ? $option->getDefault() : array();
$value['optionValues'][$key] = array('item_count' => $countValues, 'option_id' => $option->getOptionId(), 'option_type_id' => $_value->getOptionTypeId(), 'title' => $this->htmlEscape(isset($storeOptionsArr[$optionId]['values'][$_value->getOptionTypeId()]['title']) ? $storeOptionsArr[$optionId]['values'][$_value->getOptionTypeId()]['title'] : $_value->getTitle()), 'price' => $this->getPriceValue(isset($storeOptionsArr[$optionId]['values'][$_value->getOptionTypeId()]['price']) ? $storeOptionsArr[$optionId]['values'][$_value->getOptionTypeId()]['price'] : $_value->getPrice(), $_value->getPriceType()), 'price_type' => isset($storeOptionsArr[$optionId]['values'][$_value->getOptionTypeId()]['price_type']) ? $storeOptionsArr[$optionId]['values'][$_value->getOptionTypeId()]['price_type'] : $_value->getPriceType(), 'sku' => $this->htmlEscape($_value->getSku()), 'code' => $this->htmlEscape($_value->getCode()), 'tier' => $_value->getTier(), 'sort_order' => $this->_getSortOrder($_value), 'customoptions_qty' => $_value->getCustomoptionsQty(), 'checked' => array_search($_value->getOptionTypeId(), $defaultArray) !== false ? 'checked' : '', 'default_type' => $option->getType() == 'checkbox' || $option->getType() == 'multiple' ? 'checkbox' : 'radio', 'in_group_id' => $_value->getInGroupId(), 'in_group_id_view' => $_value->getInGroupId(), 'dependent_ids' => $_value->getDependentIds());
$value['optionValues'][$key]['image_button_label'] = Mage::helper('customoptions')->__('Add Image');
$imgHtml = Mage::helper('customoptions')->getImgHtml($_value->getImagePath(), $option->getId(), $_value->getOptionTypeId());
if ($imgHtml) {
$value['optionValues'][$key]['image'] = $imgHtml;
$value['optionValues'][$key]['image_button_label'] = Mage::helper('customoptions')->__('Change Image');
}
if ($this->getStoreId() != '0') {
$value['optionValues'][$key]['checkboxScopeTitle'] = $this->getCheckboxScopeHtml($option->getOptionId(), 'title', !isset($storeOptionsArr[$optionId]['values'][$_value->getOptionTypeId()]['title']), $_value->getOptionTypeId());
$value['optionValues'][$key]['scopeTitleDisabled'] = !isset($storeOptionsArr[$optionId]['values'][$_value->getOptionTypeId()]['title']) ? 'disabled' : null;
if ($scope == Mage_Core_Model_Store::PRICE_SCOPE_WEBSITE) {
$value['optionValues'][$key]['checkboxScopePrice'] = $this->getCheckboxScopeHtml($option->getOptionId(), 'price', is_null($_value->getstorePrice()), $_value->getOptionTypeId());
$value['optionValues'][$key]['scopePriceDisabled'] = is_null($_value->getStorePrice()) ? 'disabled' : null;
}
}
}
}
$value['optionValues'] = array_values($value['optionValues']);
}
} else {
$value['price'] = $this->getPriceValue(isset($storeOptionsArr[$optionId]['price']) ? $storeOptionsArr[$optionId]['price'] : $option->getPrice(), $option->getPriceType());
$value['price_type'] = isset($storeOptionsArr[$optionId]['price_type']) ? $storeOptionsArr[$optionId]['price_type'] : $option->getPriceType();
$value['sku'] = $this->htmlEscape($option->getSku());
$value['code'] = $this->htmlEscape($option->getCode());
$value['max_characters'] = $option->getMaxCharacters();
$value['file_extension'] = $option->getFileExtension();
$value['image_size_x'] = $option->getImageSizeX();
$value['image_size_y'] = $option->getImageSizeY();
$value['image_button_label'] = Mage::helper('customoptions')->__('Add Image');
//.........这里部分代码省略.........
示例11: hasDescription
public function hasDescription(Varien_Object $item)
{
return trim($item->getDescription()) != '';
}
示例12: _getGeneralTrnData
/**
* Return commno data for *all* transactions.
* @return array Data
*/
public function _getGeneralTrnData(Varien_Object $payment)
{
$order = $payment->getOrder();
$quoteObj = $this->_getQuote();
$vendorTxCode = $this->_getTrnVendorTxCode();
if ($payment->getCcNumber()) {
$vendorTxCode .= $this->_cleanString(substr($payment->getCcOwner(), 0, 10));
}
$payment->setVendorTxCode($vendorTxCode);
$request = new Varien_Object();
$request->setVPSProtocol('2.23')->setReferrerID($this->getConfigData('referrer_id'))->setVendor($this->getConfigData('vendor'))->setVendorTxCode($vendorTxCode);
$request->setClientIPAddress($this->getClientIp());
if ($payment->getIntegra()) {
$this->getSageSuiteSession()->setLastVendorTxCode($vendorTxCode);
$request->setIntegration($payment->getIntegra());
$request->setData('notification_URL', $this->getNotificationUrl() . '&vtxc=' . $vendorTxCode);
$request->setData('success_URL', $this->getSuccessUrl());
$request->setData('redirect_URL', $this->getRedirectUrl());
$request->setData('failure_URL', $this->getFailureUrl());
}
if ($this->_getIsAdminOrder()) {
$request->setAccountType('M');
}
if ($payment->getAmountOrdered()) {
$from = $order->getOrderCurrencyCode();
if ((string) $this->getConfigData('trncurrency') == 'store') {
$request->setAmount($this->formatAmount($quoteObj->getGrandTotal(), $quoteObj->getQuoteCurrencyCode()));
$request->setCurrency($quoteObj->getQuoteCurrencyCode());
} else {
$request->setAmount($this->formatAmount($quoteObj->getBaseGrandTotal(), $quoteObj->getBaseCurrencyCode()));
$request->setCurrency($quoteObj->getBaseCurrencyCode());
}
}
if (!empty($order)) {
$billing = $order->getBillingAddress();
if (!empty($billing)) {
$request->setBillingAddress($billing->getStreet(1) . ' ' . $billing->getCity() . ' ' . $billing->getRegion() . ' ' . $billing->getCountry())->setBillingSurname($this->ss($billing->getLastname(), 20))->setBillingFirstnames($this->ss($billing->getFirstname(), 20))->setBillingPostCode($this->ss($billing->getPostcode(), 10))->setBillingAddress1($this->ss($billing->getStreet(1), 100))->setBillingAddress2($this->ss($billing->getStreet(2), 100))->setBillingCity($this->ss($billing->getCity(), 40))->setBillingCountry($billing->getCountry())->setContactNumber(substr($this->_cphone($billing->getTelephone()), 0, 20));
if ($billing->getCountry() == 'US') {
$request->setBillingState($billing->getRegionCode());
}
$request->setCustomerEMail($billing->getEmail());
}
if (!$request->getDescription()) {
$request->setDescription('.');
}
$shipping = $order->getShippingAddress();
if (!empty($shipping)) {
$request->setDeliveryAddress($shipping->getStreet(1) . ' ' . $shipping->getCity() . ' ' . $shipping->getRegion() . ' ' . $shipping->getCountry())->setDeliverySurname($this->ss($shipping->getLastname(), 20))->setDeliveryFirstnames($this->ss($shipping->getFirstname(), 20))->setDeliveryPostCode($this->ss($shipping->getPostcode(), 10))->setDeliveryAddress1($this->ss($shipping->getStreet(1), 100))->setDeliveryAddress2($this->ss($shipping->getStreet(2), 100))->setDeliveryCity($this->ss($shipping->getCity(), 40))->setDeliveryCountry($shipping->getCountry())->setDeliveryPhone($this->ss(urlencode($this->_cphone($shipping->getTelephone())), 20));
if ($shipping->getCountry() == 'US') {
$request->setDeliveryState($shipping->getRegionCode());
}
} else {
#If the cart only has virtual products, I need to put an shipping address to Sage Pay.
#Then the billing address will be the shipping address to
$request->setDeliveryAddress($billing->getStreet(1) . ' ' . $billing->getCity() . ' ' . $billing->getRegion() . ' ' . $billing->getCountry())->setDeliverySurname($this->ss($billing->getLastname(), 20))->setDeliveryFirstnames($this->ss($billing->getFirstname(), 20))->setDeliveryPostCode($this->ss($billing->getPostcode(), 10))->setDeliveryAddress1($this->ss($billing->getStreet(1), 100))->setDeliveryAddress2($this->ss($billing->getStreet(2), 100))->setDeliveryCity($this->ss($billing->getCity(), 40))->setDeliveryCountry($billing->getCountry())->setDeliveryPhone($this->ss(urlencode($this->_cphone($billing->getTelephone())), 20));
if ($billing->getCountry() == 'US') {
$request->setDeliveryState($billing->getRegionCode());
}
}
}
if ($payment->getCcNumber()) {
$request->setCardNumber($payment->getCcNumber())->setExpiryDate(sprintf('%02d%02d', $payment->getCcExpMonth(), substr($payment->getCcExpYear(), strlen($payment->getCcExpYear()) - 2)))->setCardType($payment->getCcType())->setCV2($payment->getCcCid())->setCardHolder($payment->getCcOwner());
if ($payment->getCcIssue()) {
$request->setIssueNumber($payment->getCcIssue());
}
if ($payment->getCcStartMonth() && $payment->getCcStartYear()) {
$request->setStartDate(sprintf('%02d%02d', $payment->getCcStartMonth(), substr($payment->getCcStartYear(), strlen($payment->getCcStartYear()) - 2)));
}
}
$totals = $shipping->getTotals();
$shippingTotal = isset($totals['shipping']) ? $totals['shipping']->getValue() : 0;
if ($this->getSendBasket()) {
$request->setBasket($this->_getBasketContents($quoteObj));
}
if (!$request->getDeliveryPostCode()) {
$request->setDeliveryPostCode('000');
}
if (!$request->getBillingPostCode()) {
$request->setBillingPostCode('000');
}
return $request;
}
示例13: render
/**
* Render
*
* Truncate text
*
* @param Varien_Object $row
*
* @return string
*/
public function render(Varien_Object $row)
{
$helper = Mage::helper(Forkel_Grids_Helper_Data::MODULE_KEY);
return $helper->truncateText($row->getDescription(), 30);
}
示例14: directRefund
/**
* DIRECT REFUND to credit card or Token card.
*
* @param Varien_Object $object
* @param float $amount
*
* @return $this
*/
public function directRefund(Varien_Object $object, $amount)
{
$refundCurrency = $object->getCurrency();
$data = array();
$data['VPSProtocol'] = $this->getVpsProtocolVersion();
$data['TxType'] = self::REQUEST_TYPE_DIRECT_REFUND;
$data['PaymentType'] = self::REQUEST_TYPE_DIRECT_REFUND;
$data['ReferrerID'] = $this->getConfigData('referrer_id');
$data['Vendor'] = $object->getVendor();
$data['VendorTxCode'] = $this->ss('DIRECTREFUND-' . Mage::getModel('core/date')->gmtDate('Y-m-d_H-i-s'), 40);
$data['Amount'] = $this->formatAmount($amount, $refundCurrency);
$data['Currency'] = $refundCurrency;
$data['Description'] = $this->ss($object->getDescription(), 100);
if ($object->getToken()) {
$data['Token'] = $object->getToken();
$data['Storetoken'] = 1;
} else {
$data['CardHolder'] = $object->getCardholder();
$data['CardNumber'] = $object->getCardnumber();
$data['StartDate'] = $object->getStartdate();
$data['ExpiryDate'] = $object->getExpirydate();
$data['IssueNumber'] = $object->getIssuenumber();
$data['CardType'] = $object->getCardtype();
}
$data['AccountType'] = $object->getAccounttype();
$postUrl = $this->getUrl('directrefund', false, 'sagepaydirectpro', $object->getMode());
$result = $this->requestPost($postUrl, $data);
if ($result['Status'] != 'OK') {
Mage::throwException(Mage::helper('sagepaysuite')->__($result['StatusDetail']));
}
return array('request' => $data, 'response' => $result);
}
示例15: processRouteWordpressPostCategoryView
/**
* Category page
*
* @param Varien_Object $category
*/
public function processRouteWordpressPostCategoryView($category)
{
$this->_applyMeta(array('title' => $this->getTitleTaxCategory(), 'description' => $this->getMetadescTaxCategory(), 'keywords' => $this->getMetakeyTaxCategory(), 'robots' => $this->getNoindexTaxCategory() ? 'noindex,follow' : ''));
$this->_applyOpenGraph(array('type' => 'object', 'title' => $category->getName(), 'url' => $category->getUrl(), 'description' => $category->getDescription()));
if ($meta = @unserialize(Mage::helper('wordpress')->getWpOption('wpseo_taxonomy_meta'))) {
if (isset($meta['category']) && isset($meta['category'][$category->getId()])) {
$meta = new Varien_Object((array) $meta['category'][$category->getId()]);
$this->_applyMeta(array('title' => $meta->getWpseoTitle(), 'description' => $meta->getWpseoDesc(), 'keywords' => $meta->getWpseoMetakey()));
if ($meta->getWpseoCanonical()) {
$category->setCanonicalUrl($meta->getWpseoCanonical());
}
$this->_applyOpenGraph(array('title' => $meta->getWpseoTitle(), 'description' => $meta->getWpseoDesc(), 'url' => $category->getCanonicalUrl()));
}
}
return $this;
}