`
cgzhang
  • 浏览: 72060 次
  • 性别: Icon_minigender_1
  • 来自: 上海
社区版块
存档分类
最新评论
文章列表
在后台设置中: System > Configuration > Design 切换Package: 在Package设定里面: 添加 exception: Matched expression: iPhone|iPod Value: (新建的package名字,如mobile, /magento/app/design/frontend/mobile) 如果要自动切换Theme: 在Themes设定里面: 添加 exception: Matched expression: iPhone|iPod Value: (新建的theme名字,如mobile, /magento/a ...
'actions' => array( array( 'caption' => Mage::helper('productfaq')->__('Edit'), 'url' => array( 'base'=>'*/*/edit', ), 'field ...
$admin = Mage::getSingleton('admin/session')->getUser(); if($admin){ return $admin->getId(); } 注意,只在后台相应的类中有效,前台经测试无法获得。
Step 1:创建一个新的Module Step 2: 编辑模块的config.xml配置文件: [code type="xml"] <config> <modules> <Glamour_Glscatalog> <version>0.1.0</version> </Glamour_Glscatalog> </modules> <global> <blocks> <adminhtml> <rewrite> ...
下面的代码为Customer实体添加了性别属性,有两个可选值 Male和Female $installer->startSetup(); $installer->addAttribute('customer', 'gender', array( 'label' => 'Gender', 'visible' => true, 'required' => false, 'type' => 'int', 'input' => 'selec ...
protected function _logAdminAction($username, $userId, $details) { $eventCode = 'catalog_products'; //可用的event code 参见后台Admin Actions Log中Aciton Group下拉框的值 if (!Mage::getSingleton('enterprise_logging/config')->isActive($eventCode, true)) { ...
Magento中可以通过访问Url把产品加入购物车。 1 添加简单产品(Simple Product) (1) 通过产品id checkout/cart/add?product=[id]&qty=[qty] (2) 通过产品sku       $cProd = Mage::getModel('catalog/product');       $id = $cProd->getIdBySku("$sku"); 2 添加可配置产品(Configurable Product) checkout/cart/add?product=[id]&qty=[qty]& ...
$product = Mage::getModel(‘catalog/product’) ->setStoreId(Mage::app()->getStore()->getId()) ->load($productId); if($product->type_id==“simple”) { $parentId=$product->loadParentProductIds()->getData('parent_product_ids'); if(isset($parentId[0])) { //configurable pr ...
在Block类的_construct(不是构造方法)方法中加入以下代码: public function _construct() { $this->addData( array( 'cache_lifetime' => 3600, 'cache_tags' => array(Mage_Catalog_Model_Product::CACHE_TAG), 'cache_key' => 'productfaq_'.Mage::registry('product')->getId ...
$attribute = Mage::getModel('eav/config')->getAttribute('catalog_product', 'attribute_id'); foreach ( $attribute->getSource()->getAllOptions(true, true) as $option){ attrubuteArray[$option['value']] = $option['label']; }
if(product->isConfigurable()){ } $allProducts=$product->getTypeInstance(true)->getUsedProducts(null, $product); echo count($allProducts); foreach($allProducts as $simpleProduct){ echo $simpleProduct->getId().'<br/>'; }
Magento中默认时区为GMT, 不能直接使用time(), date()等方法,否则会出现时间差。 用下面的方法取当前时间(和后台设置的时区一致): date("Y-m-d", Mage::getModel('core/date')->timestamp(time())); 获得UTC时间 $date = Mage::app()->getLocale()->utcDate($store, $value, true, Varien_Date::DATETIME_INTERNAL_FORMAT); $this->setData ...
Magento中非EAV Model继承自Mage_Core_Model_Abstract,需要实现_construct方法 protected function _construct(){ $this->_init('Model tag 名/ResourceModel tag名'); } 先通过model的tag找到model的resource model的定义标签, 再从resource model的定义标签中找到对应的resource model名字。 非EAV ResourceModel继承自Mage_Core_Model_Mysq ...
重载购物车页 Mage_Checkout_CartController::indexAction(). 第一步:建立相应的文件 app/code/local/MyNameSpace/MyModule/etc/config.xml app/code/local/MyNameSpace/MyModule/controllers/Checkout/CartController.php app/etc/modules/MyNameSpace_All.xml 第二步:编辑刚才新建的配置文件 etc/config.xml 写入如下的内容: <?xml version="1.0&qu ...
$customerId=客户Id; $limit=10; $orders=Mage::getResourceModel('sales/order_collection'); $orders->addAttributeToFilter('customer_id', $customerId)->getSelect()->order('e.entity_id desc')->limit($limit);
Global site tag (gtag.js) - Google Analytics