2012/05/22

Nominal recurring products show zero in shipping fee

For recurring products, even you have set table rates/ shipping fee,

in the checkout section or cart section you will only just see Zero value, with another nominal item total / nominal shipping fee

It is confusing so that i want to set the normal shipping the same to the nominal shipping fee

The problem is here:
core/Mage/Shipping/Model/Carrier/Tablerate.php

public function collectRates


 if ($request->getFreeShipping() === true || ($request->getPackageQty() == $freeQty)) {
                //var_dump($rate['price']);
                $shippingPrice = 0;
            } else {
                $shippingPrice = $this->getFinalPriceWithHandlingFee($rate['price']);
            }

the shipping price is set to 0 .... but i don;t know why nominal product will enter this check case, maybe due to the ($request->getPackageQty() == $freeQty


Anyway , the shipping fee is now return to normal , lets see the  subtotal....



2012/05/21

Check the current page is a cms page or not


<?php
//for checking it is a CMS page, if true => show the order now button
$urlkey =  Mage::getSingleton('cms/page')->getIdentifier();

//remove any symbol
$cleanUrlKey = trim(preg_replace("/[^a-zA-Z0-9]+/", " ", $urlkey));

    if (!empty($urlkey)){

    // write down your code!!!!!!

}

?>
 

2012/05/04

console.trace()

在webkit 的debug tool or firebug 用console.trace() 超方便 自動log 哂由咩js function call 入黎!!

2012/05/01

Can't create table: eav_prefix_text , Integrity constraint violation: 1452 Cannot add or update a child row

http://www.magentocommerce.com/bug-tracking/issue/?issue=12126
http://www.magentocommerce.com/bug-tracking/issue/?issue=12336


Error :
(For magento 1.6 bug)
I encountered the same problem. In my situation I realized that the error occurring when trying to create the database table was: BLOB/TEXT column 'value' used in key specification without a key length
To force Magento to render SQL statements that my database could accept, I had to modify the app/code/core/Mage/Eav/Model/Entity/Setup.php file at approximately line 1337 (inside the createEntityTables method). Replacing the following lines:

        ->addIndex($this->getIdxName($eavTableName, array('attribute_id', 'value')),
            array('attribute_id', 'value'))
        ->addIndex($this->getIdxName($eavTableName, array('entity_type_id', 'value')),
            array('entity_type_id', 'value'))
 
With this:
 

 ->addIndex($this->getIdxName($eavTableName, array('entity_id')),  
                array('entity_id'));  

                if ($eavTableName[1] != 'text')  
                {  

                $eavTable->addIndex($this->getIdxName($eavTableName, array('attribute_id', 'value')),  
                array('attribute_id', 'value'))  
                ->addIndex($this->getIdxName($eavTableName, array('entity_type_id', 'value')),  
                array('entity_type_id', 'value'));  
                }  
 
 
 On the other hand, there is also an error for magento1.6:
Was also getting an error
-- Integrity constraint violation: 1452 Cannot add or update a child row magento
 

 
Had to remove the entity_id FK constraint (removing the ->addForeignKey... entity_id)

The createEntityTables() method Mage_Eav_Model_Entity_Setup creates FK's
 in the type sub-tables pointing at $this->getTable('eav/entity') 
instead of $baseTableName.


replace 
//                ->addForeignKey($this->getFkName($eavTableName, 'entity_id', 'eav/entity', 'entity_id'),
//                    'entity_id', $this->getTable('eav/entity'), 'entity_id',
//                    Varien_Db_Ddl_Table::ACTION_CASCADE, Varien_Db_Ddl_Table::ACTION_CASCADE)
//                

with this:

 $eavTable->addForeignKey($this->getFkName($eavTableName, 'entity_id', 'eav/entity', 'entity_id'),  
'entity_id', $baseTableName, 'entity_id',  
Varien_Db_Ddl_Table::ACTION_CASCADE, Varien_Db_Ddl_Table::ACTION_CASCADE)