Month: March 2016

Magento: 通过id获取类别名字等信息 get category by id

<?php // get category model by category id, assume you have known category id, $categoryId $_category = Mage::getModel('catalog/category')->load($categoryId); // category name $categoryName = $_category->getName(); // category description $categoryDescription = $_category->getDescription(); // category url $categoryUrl =… Read More

Magento事件与事件监听

事件和事件监听也许是magento中最有趣的功能之一,因为它允许开发者来扩展magento应用程序中的关键部分。 为了为不同模块之间提供更多的灵活性和便利,magento使用了一种事件/监听模式,这种模式允许模块之间进行松散耦合。 在这个系统中有两部分,一部分是事件分发对象和事件信息,另一部分是监听特定的事件。 一、事件分发 事件的创建和分 发使用Mage::dispatchEvent() 函数。核心团队已经在一些核心关键部分创建了一些事件,例如,模型抽象类Mage_Core_Model_Abstract 在一个模型每次保存的时候调用了两个protected函数—— _beforeSave() 和_afterS… Read More

Magento: 获取类别所有子类别 (无限级别-目录树) Get All Sub Categories

生成分类目录树(Category Tree) $rootcatId = Mage::app()->getStore()->getRootCategoryId(); $categories = Mage::getModel('catalog/category')->getCategories($rootcatId); function get_categories($categories) { $array = '<ul>'; foreach ($categories as $category) { $cat = Mage::getModel('catalog/category')->load($ca… Read More

PHP类: SEO必备的伪原创工具 (文章重写)

伪原创工具是一种基于SEO理论的网络文章编辑软件的统称,主要功能是把从网上复制来的文章进行“原创”操作。 让复制来的文章瞬间变的看起来像原创一样,然后达到让搜索引擎认为是“原创”从而提高网站收录率,和收录数量。 专门针对谷歌、百度、雅虎等大型搜索引擎收录设计,通过伪原创工具生成的文章,会更好的被搜索引擎收录和索引到。 方法一:  在线工具 这个就不多说了,直接谷歌一下就可以,实在不行就 点击这里,我帮你搜! 方法二: PHP 类 说白了,方法很简单,就是单词替换而已,只是词库才是重点,没有词库,一切都是浮云啊! PHP Spintax Class <?PHP /** * Spintax - A helper class to pro… Read More

Magento: 获取产品评论 get all reviews with review summary

1. 根据产品id获取该产品评论 $productId = 1234; $product = Mage::getModel('catalog/product')->load($productId); $storeId = Mage::app()->getStore()->getId(); Mage::getModel('review/review')->getEntitySummary($product, $storeId); $ratingSummary = $product->getRatingSummary(); print_r($ratingSummary->getData());… Read More

Android模拟器genymotion的安装和使用

Genymotion概述 Genymotion是一套完整的工具集,旨在为Android提供虚拟环境。开发人员、测试人员、销售人员甚至是游戏玩家都能从中获得众多实用功 能。 它可用于大多数操作系统:Windows、Linux以及MacOS X。它既易于安装,又具备强大的功能:遵循简单的安装流程指引、选择一款Android虚拟设备、启动工具,大功告成! Genymotion特色 最佳Android虚拟效果 OpenGL加速机制带来最佳3D性能 从Google Play安装应用程序 提供全屏选项,改善使用体验 完全可控 同时启动多台虚拟设备 提供多种管理传感器: 电池电量/状态 GPS 加速器 可直接利用Genymotion shel… Read More