私はカスタムロイヤリティポイントモジュールを開発中です。チェックアウト中、顧客はポイントを交換することができます。
モジュールのセットアップでは、私はredeem_points eav_attributeを作成している(それはeav_attributeテーブルに存在します)と私は引用に属性を追加した、まあ、一種の...ここ
は、私はそれをやった方法です。Magentoに新しい属性を追加する
- mysql4-install-0.1.0.php私はを呼び出します。$ installer-> installEntities();再び
'quote' => array( 'entity_model' => 'sales/quote', 'table' => 'sales/quote', 'attributes' => array( 'redeemed_points' => array('type' => 'static') ), ),
:のみ(とりわけ)を含む配列を返す(Mage_Eav_Model_Entity_Setupを拡張)Namespace_Module_Model_Resource_Eav_Mysql4_Setupで
のみ1方法パブリック関数getDefaultEntitiesが(ある) mysql4-install-0.1.0.php sales_flat_quoteテーブルに列を作成します。このように
//add redeemed_points to quote table $installer->getConnection()->addColumn($installer->getTable('sales/quote'), 'redeemed_points', 'bigint(20)'); $installer->addAttribute('quote', 'redeemed_points', array('type'=>'static'));
私はMage_Checkout_Model_Type_Onepageが呼び出された拡張私のクラスからのポイント、メソッドのセーブポイント($データ)を償還チェックアウト、で
:
public function savePoints($data)
{
//save data
if ($data == 1) {
$redeemedPoints = Mage::helper('points')->getRedeemablePoints();
$this->getQuote()->setRedeemedPoints($redeemedPoints['points']);
} else {
$this->getQuote()->setRedeemedPoints(0);
}
$this->getQuote()->collectTotals()->save();
$this->getCheckout()
->setStepData('points', 'complete', true);
if ($this->getQuote()->isVirtual()) {
$this->getCheckout()->setStepData('payment', 'allow', true);
} else {
$this->getCheckout()->setStepData('shipping_method', 'allow', true);
}
Mage::helper('firephp')->debug($this->getQuote()->debug());
return array();
}
あなたは、私がfirephpに引用オブジェクトをデバッグすることがわかります:現時点では(チェックアウトのこのステップでは、引用符に保存するだけで)正しい値でredeemed_points属性が表示されます。
私の問題は、次のステップで、この属性が引用オブジェクトから消えてしまったことです。(
私はredeemed_points属性を引用オブジェクトに含めることはできませんが、実際には'm missing ...
どんな人ですか?
をこのhttp://stackoverflow.com/questions/4315660/alter-table-in-magento-setupを参照してください。 -script-without-using-sql/4318501#4318501 –
mmmこのリンクは、セットアップスクリプト内でテーブルを作成/変更する方法を説明していますが、ここでは私の問題ではありません:テーブルが作成/変更されています。私のDBのフィールド。 私の問題は、redeemed_pointsをquoteオブジェクトに含めることができないことです。まあ、Model_Type_OnepageでsavePoints関数を呼び出すとそこにありますが、次のステップでは消えません。 – OSdave