Apache Service detected with wrong path ON XAMPP upgrade V3.2.2

XAMPP更新的时候,如果已经老版本存在的话,需要修改环境变量的PATH,还有可能需要修改注册表

进入注册表—>

点击HKEY_LOCAL_MACHINE—->system—->currentControlSet—->Services—->找到Apache2.4,
修改ImagePath

保存退出,重启XAMPP

 

此外,新版V3.2.2安装时候,提示关闭windows的UAC

在控制面板–用户账户–更改用户账户设置 

滑块拉到最低,保存,重启。

magento addAttributeToFilter 的方法和AND OR使用

文章整理来自网络,主要参考有:

http://fishpig.co.uk/magento/tutorials/addattributetofilter/

http://stackoverflow.com/questions/5301231/addattributetofilter-and-or-condition-in-magentos-collection


主要的句子

$_products = Mage::getResourceModel('catalog/product_collection')
   ->addAttributeToSelect(array('name', 'product_url', 'small_image'))
   ->addAttributeToFilter('sku', array('like' => 'UX%'))
    ->load();

 

addAttributeToSelect没什么要说的,只要筛选正确的数据表有的字段就可以

 

eq的两种写法写法

$_products->addAttributeToFilter('status', array('eq' => 1)); // Using the operator
$_products->addAttributeToFilter('status', 1); // Without using the operator

如果上面有不同的筛选,就相当于AND了,OR的写法:

// OR QUERY

$collection->addAttributeToFilter(array(

array(

'attribute' => 'sku','like' => '%ch%'),

array(

'attribute' => 'status','eq' => '1')

));

 

noequal

$_products->addAttributeToFilter('sku', array('neq' => 'test-product'));

 

$_products->addAttributeToFilter('sku', array('like' => 'UX%'));//like

 

$_products->addAttributeToFilter('sku', array('nlike' => 'err-prod%'));//nolike

 

$_products->addAttributeToFilter('id', array('in' => array(1,4,98)));//in

 

$_products->addAttributeToFilter('id', array('nin' => array(1,4,98))); //not in

 

$_products->addAttributeToFilter('description', array('null' => true));  //null

 

$_products->addAttributeToFilter('description', array('notnull' => true)); //not mull

 

$_products->addAttributeToFilter('id', array('gt' => 5));//Greater Than - gt

 

$_products->addAttributeToFilter('id', array('lt' => 5)); //Less Than - lt

 

$_products->addAttributeToFilter('id', array('gteq' => 5)); //Greater Than or Equals To- gteq

 

$_products->addAttributeToFilter('id', array('lteq' => 5)); //Less Than or Equals To - lteq

 

排错方法

// Method 1
Mage::getResourceModel('catalog/product_collection')->load(true);

// Method 2
$collection = Mage::getResourceModel('catalog/product_collection')

echo $collection->getSelect();

 

 

mysql语句根据sku 查询magento的产品名

答案来自http://stackoverflow.com/questions/5323102/magento-products-import-from-database-using-sql-query

第一步,找出各个属性对应的attribute_code

select attribute_code, attribute_id, backend_type from eav_attribute
    where entity_type_id = (select entity_type_id from eav_entity_type where entity_type_code = 'catalog_product')
      and attribute_code in ('name', 'url_path', 'price', 'image', 'description', 'manufacturer');

一般结果为

+----------------+--------------+--------------+
| attribute_code | attribute_id | backend_type |
+----------------+--------------+--------------+
| description    |           61 | text         |
| image          |           74 | varchar      |
| manufacturer   |           70 | int          |
| name           |           60 | varchar      |
| price          |           64 | decimal      |
| url_path       |           87 | varchar      |
+----------------+--------------+--------------+

对应的name是60

第二步

select p.sku, p.entity_id, n.value name
    from catalog_product_entity p
    join catalog_product_entity_varchar n on n.entity_id = p.entity_id
  where n.attribute_id = 60 AND p.sku='001-C';

可以得出结果了,其他属性自己添加查询

再次感谢Joseph Mastey的回答

 

magento bundle product backend tier price 组合产品的分组价格

magento在后台显示bundle的产品时,是按照Percent Discount的折扣率显示的,不能直接显示bundle的分组价格具体是多少

主要改动文件有两个

\app\code\local\Mage\Bundle\Model\Product\Price.php

搜索  / 100

line 618

 // $tierPrice = $finalPrice – ($finalPrice * ($tierPrice / 100));
            $tierPrice = $tierPrice;

如果也要修改group的话,自己对应修改

第二个,去掉数据验证

1). 1.7的版本以上的

app\code\local\Mage\Core\etc\jstranslator.xml

line 165

  <!–   <validate-percents translate="message" module="core">
        <message>Please enter a number lower than 100.</message>
    </validate-percents>
    –>

2) 1.5的版本的js位置是 \js\prototype\validation.js line 717 这个拿掉全局的Js关于百分比的验证

建议的做法是 app\code\core\Mage\Bundle\Block\Adminhtml\Catalog\Product\Edit\Tab\Attributes.php line 96~97

                    //->setPriceColumnHeader(Mage::helper('bundle')->__('Percent Discount'))
                    ->setPriceColumnHeader(Mage::helper('bundle')->__('Price'))
                    //->setPriceValidation('validate-greater-than-zero validate-percents')

去掉验证,又可以改名字

第三,其他一些文件,比如对应前台主题文件需要修改,不然就会

Buy 1 with 300% discount each

Buy 2 with 200% discount each

暂时就是这样,转载记得署名出处