我想添加一个新的产品属性,该属性呈现一个包含所有CMS页面的下拉列表作为其选项.我创建了一个扩展,并希望通过安装脚本添加此属性.但是在运行之后,Magento破坏了eav_entity_type表......
到目前为止我尝试了什么:
mysql4安装-0.1.0.php:
$installer = $this;
$setup = new Mage_Eav_Model_Entity_Setup('core_setup');
$installer->startSetup();
$setup->addAttribute('catalog_product', 'test_report', array(
'label' => 'Test report',
'required' => false,
'input' => 'select',
'source' => 'cmspageselect/entity_source',
'default' => 'none',
'position' => 1,
'sort_order' => 3,
));
$installer->endSetup();
Run Code Online (Sandbox Code Playgroud)
cmspageselect/entity_source类的源代码:
class Mandarin_CMSPageSelect_Model_Source extends Mage_Eav_Model_Entity_Attribute_Source_Abstract {
/**
* Retrieve Full Option values array
*
* @param bool $withEmpty Add empty option to array
* @return array
*/
public function getAllOptions($withEmpty = true)
{
$storeId = $this->getAttribute()->getStoreId();
if (!is_array($this->_options)) {
$this->_options = array(); …Run Code Online (Sandbox Code Playgroud) 嗨,大家好,
我目前正在开发一种支付方式,事情进展顺利.只有一件事:客户在付款方式中输入一些信息,通过调试,我可以看到它通过Mage_Payment_Model_Method_Abstract :: assignData()写入InfoInstance.不幸的是,当我处于捕获状态时,我无法读取该数据( )-方法.我检索InfoInstance并尝试读取信息,但它没有设置.
assignData()方法:
public function assignData($data) {
if (!($data instanceof Varien_Object)) {
$data = new Varien_Object($data);
}
$info = $this->getInfoInstance();
$info->setEtixType($data->getEtixType());
return $this;
}
Run Code Online (Sandbox Code Playgroud)
capture()方法:
public function capture(Varien_Object $payment, $amount) {
// ...
$info = $this->getInfoInstance();
Mage::log('etix_type: '.$info->getEtixType()); //I expect something like "etix_type: cc"
// ...
}
Run Code Online (Sandbox Code Playgroud)
任何帮助表示赞赏.我确定我错过了什么......
谢谢,aeno
在Magento 1.6.0中,我想在客户选择PayPal Express付款时添加2%的付款费用.不幸的是,Magento的PayPal模块不提供收费选项.
我怎样才能做到这一点?
提前谢谢,aeno