
magento
emily_init
这个作者很懒,什么都没留下…
展开
-
magento自定义后台配置
示例路径如下:D:\htdocs\magento_a\app\code\local\Exercise\Avatar第一步:建module的配置文件 D:\htdocs\magento_a\app\etc\modules\Exercise_Avatar.xml true local原创 2012-09-26 18:07:19 · 2288 阅读 · 0 评论 -
magento 清空购物车
清空购物车 public function clearItems() { $cartHelper = Mage::helper('checkout/cart'); //Get all items from cart $items = $cartHelper->getCart()->getItems(); /原创 2013-01-22 17:31:33 · 1442 阅读 · 0 评论 -
更新cart item的price
$quote = Mage::getModel('checkout/cart')->getQuote(); $_cartItems = $quote->getAllVisibleItems(); foreach ($_cartItems as $_cartItem) { $productId原创 2013-03-07 10:22:21 · 952 阅读 · 0 评论 -
magento addattributetoselect使用
$collection = Mage::getModel('catalog/product')->getCollection() ->addAttributeToSelect($collection = Mage::getModel('catalog/product')->getCollection() ->addAttributeToSelect('nam原创 2013-02-26 11:14:00 · 2037 阅读 · 0 评论 -
magento各版本简称及翻译
Magento CE:Magento Community Edition [magento社区版]Mageto EE: Enterprise Edition [magento企业版]原创 2013-05-14 15:05:15 · 1369 阅读 · 0 评论 -
magento Scope
Global means that the value of this attribute for a given product must be the same throughout your website. Global 表示这个产品属性在所有website里都是一样的.Website means that the value of this attribute for翻译 2013-05-14 16:45:12 · 692 阅读 · 0 评论 -
magento 常用方法
根据websiteId获取所有属于此website的产品collection: $_productCollection = Mage::getModel('catalog/product')->setWebsiteId( $websiteid)->getCollection();原创 2013-06-05 14:44:36 · 601 阅读 · 0 评论 -
magento 后台xml配置
http://www.magentocommerce.com/wiki/5_-_modules_and_development/admin/xml_structure_for_admin_configurations#frontend_type_types转载 2013-06-21 14:22:28 · 644 阅读 · 0 评论 -
获得某个用户使用某个coupon的次数
$couponCode = 'WELCOME'; //coupon name $coupon = Mage::getModel('salesrule/coupon'); $coupon->load($couponCode, 'code'); $couponUsage = new Varien_Object(); $customerId原创 2013-09-04 18:20:12 · 861 阅读 · 0 评论 -
为自定义页面加page
protected function _prepareLayout() { $pager = $this->getPagerBlock(); // called prepare sortable parameters $collection = $this->getImportedProducts(); //attention: $collecti原创 2013-10-09 14:53:33 · 692 阅读 · 0 评论 -
magento后台设置笔记
设置税:Sales > Tax > Manage Tax Rates原创 2013-02-06 17:22:09 · 690 阅读 · 0 评论 -
magento添加多域名网站
Tutorial: Multi-Site, Multi-Domain SetupCategory: Build Your Store Tomas G, Magento SupportOne of Magento’s greatest strengths is its capabilities for scaling to support mu转载 2013-02-07 16:55:12 · 1029 阅读 · 0 评论 -
更新cart中的item的custom option值
$cart = Mage::getModel("checkout/cart"); $request = array('id' => "36", //item id 'product' => "62", //product_id 'related_product' => "",原创 2012-10-31 18:46:05 · 485 阅读 · 0 评论 -
更新order的item的custom option的值
注意$options的结构$options[]['value'] ='value' ;$options[]['print_value'] = 'print_value';$options[]['option_value'] = 'option_valule';$re = $item->setProductOptions($optionsOr);$re->save();可原创 2012-11-01 16:28:46 · 553 阅读 · 0 评论 -
各种获取product的方式
根据sku:$sku = 'SKU';$_product = Mage::getModel('catalog/product')->loadByAttribute('sku', $sku);根据order id:$orderId = '229'; $items = Mage::getModel('sales/order')->load($ord原创 2012-12-03 17:06:31 · 769 阅读 · 0 评论 -
magento错误处理
Mage::throwException( Mage::helper('sales')->__('Nominal item can be purchased standalone only. To proceed please remove other items from the quote.') );原创 2012-12-07 15:59:14 · 398 阅读 · 0 评论 -
magento更新产品属性值 eg. visibility
$attributeData = array('Visibility'=>Mage_Catalog_Model_Product_Visibility::VISIBILITY_NOT_VISIBLE);$product = Mage::getModel('catalog/product')->load($productId); $storeIds = $pr原创 2012-12-21 15:26:33 · 808 阅读 · 0 评论 -
magento 获取路径
获取modules的路径 Mage::getUrl('checkout/cart');获取js路径:Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_JS)获取Css路径:$this->getSkinUrl('css/styles.css')原创 2012-12-07 16:00:06 · 610 阅读 · 0 评论 -
magento 获取国家名字 get country name
echo Mage::app()->getLocale()->getCountryTranslation("CN"); //注意locale,根据本地语言获取国家名字 Mage::getSingleton('core/translate')->init('zh_CN', true); $country_name = Mage::getModel('directory原创 2012-12-27 16:58:10 · 2115 阅读 · 0 评论 -
magento 添加Creditmemo记录
当refund发生在线下,需要用程序加creditmemo时,如下代码可供参考1.可以调用sales/order_creditmemo_api的create()方法来生成creditmemo记录,function addCreditMemo($targetMagentoGoServiceId, $orderId, $commentText) { $product = Mag原创 2013-01-17 18:01:31 · 1594 阅读 · 0 评论 -
magento添加产品[有quote/无quote]
有quote:<?phpclass Emily_Order_Model_orderCreate extends Mage_Core_Model_Abstract { private $_storeId = '1'; private $_groupId = '1'; private $_sendConfirmation = '0'; private $o原创 2013-01-18 18:14:21 · 2108 阅读 · 0 评论 -
magento send email
protected function _sendEmailTemplate($template, $sender, $templateParams = array(), $storeId = null) { /** @var $mailer Mage_Core_Model_Email_Template_Mailer */ $mailer = Mage:原创 2014-04-10 18:13:06 · 1335 阅读 · 0 评论