2012-11-21 25 views
1

我想將一些變量發佈到opencart中的特定文件。我的問題是,我不知道如何指定文件發佈到。這是我的checkout.tpl文件,在默認模板中。我試圖將變量發佈到我的confirm.tpl文件中,也在默認模板中。這是儘可能接近我有:將變量發佈到opencart中的文件

$('#button-account').live('click', function() { 
        var var1= $('#var1').val(); 
        var var2= $('#var2').val(); 
        $.post("catalog/view/theme/default/template/checkout/confirm.tpl", { quantity: quantity, total: total }); 

任何幫助將不勝感激。

回答

0

由於OpenCart的MVC性質,您實際上需要將結果發佈到配置爲接受ajax帖子的控制器中的特定函數,而不是模板。

試試閱讀Jay Gilford提供的How to become an OpenCart guru?的答案。您可能會更好地瞭解系統以及如何將所有內容組合在一起。

add()功能checkout/cart配置爲json,看看你是否可以解決這個問題。

$.post("catalog/view/theme/default/template/checkout/confirm.tpl", { quantity: quantity, total: total }); 

或許應該讀的東西,如:

$.post("index.php?route=checkout/confirm/<function here>", { quantity: quantity, total: total });