ビューで使用するコントローラーからデータを渡そうとしています。何が起こっているのかというと、ユーザーが選択した製品のスーパー属性(サイズと色)を取得し、それらすべてがシリアル化されてコントローラーに渡され、そこで製品オブジェクトが取得されます。このオブジェクトから、構成可能なSKUを取得できます。これを、デザインview.phtmlファイルにエコーアウトする必要があります。
コントローラの関数は次のようになります。
if($product = $this->_initProduct())
{
$config = $product->getSku();
// if I echo $config here using firephp I can see that this is correct value
Mage::register('config_product', $config);
// I am hoping to set it as a global variable here that
// I can then retrieve on the success of the ajax function
}
phtmlには、フォーム値をそのコントローラーに送信するための次のようなものがあります。
var data = $("#product_addtocart_form").serialize();
$.ajax({
url: "/locator/item/index",
data: data
}).done(function(){
<?php $currentProduct = Mage::registry('config_product');
// Why does this return blank??
?>
<?php Mage::helper('firephp')->send( $currentProduct ); ?>
});