Category: WP / Joomla! / Magento / Shopify / Drupal / Moodle / Zimbra

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

解决WP表前缀更换后出现的You do not have sufficient permission

将安装的wordpress表前缀由默认的 wp_修改为其它了,再次登陆后台后出现 You do not have sufficient permissions to access this page. 网上搜索了一下,说是修改检查 wp_usermeta 表中的 wp_capabilities, wp_user_level 数值,但是无效,再搜索发现如下方法解决问题 步骤1. 将wp_usermeta 表中对应wp_前缀设置的 wp_capabilities, wp_user_level,wp_autosave_draft_ids 的前缀 wp_ 修改为新的前缀 步骤2. 将wp_options 中wp_user_roles 前缀 wp_ 修改为新的前缀… Read More

Magento: Service Temporarily Unavailable 解决

My Application was working fine yesterday. I started my Pc today when I tried to start magento I Got This Error message.     Service Temporarily Unavailable     The server is temporarily unable to service your request due to maintenance downtime or capacity problems. Please try again later. I am not able to Open even admin page and I

Magento: 设置产品列表默认排序方式 How to sort Magento products by date added as default

方法一: 安装插件 Sort By Date(https://www.magentocommerce.com/magento-connect/sort-by-date.html) 方法二: 非插件 Today I had to change Magento default products list sorting to sort by product’s date. In fact we don’t need to sort by date, just by entity_id which is product ID in Magento world. To accomplish this, we need to edit /app/code/core/Mage/Catalog/Blo… Read More

Magento: 添加first name 和 last name到newsletter Add additional fields to your newsletter form and show a popup for subscription.

1. 首先,自定义添加区域,安装插件 Extended Newsletter Subscription (https://www.magentocommerce.com/magento-connect/extended-newsletter-subscription.html)   下载包:Mediarocks_NewsletterExtended-0.3.5 2. 添加到footer your theme is located at /app/design/frontend/default/mytemplate/layout/local.xml <?xml version="1.0"?> <layo… Read More

Magento: 自动生成产品SKU Auto generated SKU when add product in magento

方法一: Open /app/design/adminhtml/default/default/template/catalog/product/edit.phtml and add the following code to the bottom of the file: <?php $dbread = Mage::getSingleton('core/resource')->getConnection('core_read'); $sql = $dbread->query("SELECT * FROM catalog_product_entity ORDER BY created_at DESC LIMIT 1"); $res = $… Read More

Magento: 设置category类别为必填 How to make product category selection required

You can rewrite the method Mage_Adminhtml_Catalog_ProductController::validateAction() and check if the product is new and category_ids hasn’t been sent through POST then throw an exception. Something like this: app/code/core/Mage/Adminhtml/controllers/Catalog/ProductController.php public function validateAction() { $response… Read More

Magento: 左栏筛选条件 Select Box / Button / Dropdown List on Layered Navigation

1. 下拉框 Select Box You have plain text and link to those text in Magento Layered Navigation section. You can easily change the display of Layered Navigation links into a selection box / dropdown list. To do so, you need to edit the following file: app/design/frontend/YOUR_PACKAGE/YOUR_THEME/template/catalog/layer/filter.phtml filter.phtml file con… Read More

Magento: 单产品(product)或者当前类别(category)最大和最小价格 Min/Max Product Price in a Category

1. 当前类别最大最小价格: $minPrice = Mage::getModel('catalog/product')->getCollection() ->addStoreFilter() ->addAttributeToSelect('price') ->addAttributeToSort('price', 'ASC')->getFirstItem()->getMinimalPrice()*1; $maxPrice = Mage::getModel('catalog/product')->getCollection() ->addStoreFilter() -&g… Read More

Magento: 无法登录后台 Can’t login to admin panel

This tutorial shows how to resolve the Magento admin panel login issue. It’s a common issue: you are trying to login to the Magento admin panel, typed your username and password, clicked Login button and nothing happens. The page refreshes and that’s all. No error or any other messages. This is caused by the cookies issue. In

Magento: Mage::getResourceModel, Mage::getModel 和 Mage::getSingleton() 的区别 when to use Mage::getResourceModel, Mage::getModel and Mage::getSingleton()

Perfect differece with example for getsingleton and getmodel. Mage::getSingleton() Mage::getSingleton() will first check if the same class instance exists or not in the memory. If the instance exists then it will return the same object from the memory. So Mage::getSingleton() is faster than Mage::getModel(). Example $product1 = Mage::getSingleto… Read More

Magento: 获取客户信息 Get Customer’s Full Name, First Name, Last Name and Email Address

1.  获取已登录客户信息 // Check if any customer is logged in or not if (Mage::getSingleton('customer/session')->isLoggedIn()) { // Load the customer's data $customer = Mage::getSingleton('customer/session')->getCustomer(); $customer->getPrefix(); $customer->getName(); // Full Name $customer->getFirstname(); // First Name $cu… Read More