`
shuishui8310
  • 浏览: 150456 次
  • 性别: Icon_minigender_1
  • 来自: 宁波
社区版块
存档分类
最新评论
文章列表
Magento遵循一般的方法使用第三方PHP库,即:将php库放到某个目录下,在php.ini或程序头部指定该目录或者父目录指定为include_path,然后程序中使用include_once相对路径包含具体引用的php文件Magento的lib目录已经默认指定为include_path里了,所以如果有3rd包如Varien放到lib目录下,有一个php文件全名为$magento_home/lib/Varien/Object.php那么在Magento的代码中只要:include_once('Varien/Object.php'); 就可以调用里面的类和函数了。 出处:http://ko ...
$customer = Mage::getSingleton('customer/session')->getCustomer(); $customer->setData( 'group_id', '2'); $customer->save(); 同理,你也可以修改用户的其它信息
Magento的提示信息一般显示在每个页面主内容块的最上方,其中警告或错误信息为红色背景,成功信息为绿色背景。如果我们自己要添加一些提示信息可以这样操作: 成功信息 Mage::getSingleton('customer/session')->addSuccess('恭喜您关联会员卡成功!'); Mage::getSingleton('customer/session')->addError('关联失败,请检查您填写的信息是否正确!'); 其中'customer/session'是指这些信息会在“我的账户”相关页面显示,如果要在购物车或 ...
名称: Featured Products Extension Key:magento-community/Inchoo_FeaturedProducts网址:http://www.magentocommerce.com/extension/2513/featured-products介绍: One of the most requested feature in Magento is the ability to have a featured products. Those of you who used osCommerce, ZenCart or some other shoppi ...
<!-- #main --> Magento is based on MVC model. This model helps for defining models, view (layout + templates) and controllers. Despite big amount of modules available by default in Magento and on Magento Connect, you may want to create your own module and ...
一直以来,实现畅销排行(Bestseller)的插件或自己写的模块,其核心的代码都是一致的,如下: $products = Mage::getResourceModel('reports/product_collection') ->addOrderedQty() //->addAttributeToSelect('*') ->addAttributeToSelect(array('name', 'price', 'small_image', 'short_descrip ...
想在产品页显示可配置产品所属的简单产品的库存,解决方案如下: 打开文件mage/catalog/block/product/view/type/configurable.php,大概在85行可以找到如下代码: foreach ($this->getAllowAttributes() as $attribute) { $productAttribute = $attribute->getProductAttribute(); $attributeValue = $product->getDat ...
/*** * * @see Mage_Catalog_Model_Product_Type_Configurable::getUsedProductCollection() * **/ //get a model to use $product = Mage::getModel('catalog/product'); //load it up $parent = $product->load(/* Parent Id Here */); //get the collection $children = Mage::getModel('catalog/produc ...
名称: Shop by manufacturer/brand/character/etcExtension Key:magento-community/DC_Catalog网址: http://www.magentocommerce.com/extension/1921/shop-by-manufacturer-brand-character-etc---attribute-info-pages介绍: 表面上看是一个卖0.01块的收费插件,其实是免费的,详细信息可以看这里http://dot.collective.ro/magento-output/magento-shop-by-manu ...
Magento根据官方扩展中心Magento Connect里面扩展被下载次数的统计,列出了之前一周(1月31日至2月5日)的十大最具人气扩展。这边小做围观一下: WYSIWYG Editor:为管理后台相关页面添加所见即所得编辑器。(作者:Fontis) Blog Extension:为Magento提供全套博客功能。(作者:aheadWorks) Flash Gallery ‘Flip’ and the new extension ‘CMS Content-Editor:兼容CMS编辑模式的FLASH相册。(作者:muc1) Enhanc ...
Magento采用prototype作为它的核心JS库,而prototype.js文件 有127KB之大,因为是核心库,相信也没有人会需要去改它的源代码 ,既然这样,我们可以改为导入压缩后的核心文件,为前台 网页载入减轻一点负担。 下面是本人自己压缩的核心库,欢迎下载 试用prototype.min.zip (22.77 KB) 解压后把prototype.min.js放置到\js\prototype目录下,同时修改文件\app\design\frontend\default\yourtheme \layout\page.xml, 用 <act ...
在Magento中,一个产品可以同时属于多个分类,下面的代码可以在产品页获得当前产品的所有父分类 $categories = $_product->getCategoryCollection(); foreach($categories as $_category) { // do something }
1.3中,reports/product_collection模块包含category_ids 属性,也就是说产品可以根据分类来过滤,但在1.4中category_ids 不存在了,分别运行以下代码可以看出reports/product_collection模块中的属性在1.3和1.4中的不同。 $_productCollection = Mage::getResourceModel('reports/product_collection') ->addAttributeToSelect('*'); $_productCollection->load(); ...
运行下面的代码,$AttrCode为新增的字段名 <?php $setup = new Mage_Eav_Model_Entity_Setup('core_setup'); $AttrCode = 'occupation'; $settings = array ( 'position' => 1, 'is_required'=> 0 ); $setup->addAttribute('1', $AttrCode, $settings); ?>
if(empty(Mage::getModel('catalog/product_type_configurable')->getParentIdsByChild($product->getId())) echo $product->getName();
Global site tag (gtag.js) - Google Analytics