God help me see how this code changed.

Source: Internet
Author: User
  • "Hot and sour chicken giblets"
  • Ingredients:
  • 13.00



  • This is someone else's, I want to use Smarty output query to the result, should change where


    Reply to discussion (solution)

    First we have to change the price.
    and a picture.

    And the price of adding a shopping cart after clicking

    Where do you want to change the code, convenient to change the code to send it, you send the code I really do not see where to change.

    Where do you want to change the code, convenient to change the code to send it, you send the code I really do not see where to change.
    Sorry, I mean the original JS unchanged is the price and the name (these are all smarty) traversed out


    Younger brother Beginner, to the above HTML half do not understand, so ask for advice. Post the Smarty traversal

     
      Assign ("title", "Welcome to my ordering system"), $tpl->display ("Index.tpl"), $sql = "SELECT * from Menu"; $query =mysql_query ("$sql"); while (($row =mysql_fetch_array ($query)) ==true) {$menuarray []= $row;} $tpl->assign ("Menu_array", $menuarray);  /*html traversal {? section name=list loop= $menu _array?}    {? $menu _array[list].menu_name?}       The name of the dish {? $menu _array[list].price?}          Price {? Sectionelse?} There is no orders. {?/section?} */

    Oh, you sent this code I also a bit do not understand, carefully looked at you above the HTML code:
    When clicked, the trigger is this method: Thisjs.cart_add, this method has two parameter pass, an ID, a name, you put this two parameters for you to pass the two values to try.
    Since the Thisjs.cart_add () code does not know how to write, I can only analyze here.

    Oh, you sent this code I also a bit do not understand, carefully looked at you above the HTML code:
    When clicked, the trigger is this method: Thisjs.cart_add, this method has two parameter pass, an ID, a name, you put this two parameters for you to pass the two values to try.
    Since the Thisjs.cart_add () code does not know how to write, I can only analyze here.


    The other part of the code is like this is not I write, I can not read is JS

    Kj.onresize (function () {me_resize ();}); Kj.onload (function () {me_resize (); Kj.show ("#id_cart_menu");}); function Me_resize () {var h = document.documentelement.clientheight-32;var L = (document.documentelement.clientwidth-9 /2;kj.set ("#id_cart_menu", ' style.top ', H + "px"), Kj.set ("#id_cart_menu", ' style.left ', L + "px");}  var Thisjs = new function () {this.mintotal = Kj.toint (' 10 ');//lowest offer price this.total = 0;//Total amount This.cart_show = 0;this.cart_lock = False;this.cart_add = function (o) {var obj = kj.obj ("#id_cart_box"), var obj_cart_num = kj.obj ("#id_cart_num_" + o.id); F (obj_cart_num) {var obj_cart_price = kj.obj ("#id_cart_price_" + o.id); obj_cart_num.value = Kj.toint (obj_cart_ Num.value) + 1;obj_cart_price.innerhtml = "¥" +kj.toint (obj_cart_num.value) * o.price;} else {var obj_li=document.createelement ("Li"); obj_li.id = "Id_cart_" + o.id;obj_li.innerhtml = '' +o.name+ '¥ ' +kj.toint (o.price) + '¥ ' +kj.toint (o.price) + ''; Obj.appendchild (Obj_li);} This.refresh_price ();} Delete This.del = function (id) {kj.remove ("#id_cart_" +id); This.refresh_price ();} Change Quantity This.change_num = function (ID, num) {var obj_cart_num = kj.obj ("#id_cart_num_" + id); val = Kj.toint (Obj_cart_num.va Lue); if (num) {val+=num;if (val<1) Return;obj_cart_num.value = val;} if (obj_cart_num) {var obj_cart_price = kj.obj ("#id_cart_price_" + ID), var obj_price = kj.obj ("#id_price_" +id); if (obj_ Cart_price) obj_cart_price.innerhtml = "¥" +val * kj.toint (Obj_price.value); This.refresh_price ();}} Refresh Price This.refresh_price = function () {var obj = kj.obj ("#id_cart_box. Col4"); var = 0;for (var i = obj.length-1; I & gt;=0; i--) {price + = Kj.toint (obj[i].innerhtml);} Kj.set ("#id_cart_menu. X_2", ' InnerHTML ', ' +obj.length+ ' share, Total: ') kj.set ("#id_cart_menu. X_3", ' InnerHTML ', ' ¥ ' +pric e); this.total = price;if (Price = = 0) {this.showcart (0);} else {This.showcart (1);} return price; Empty this.clear = function () {var obj = kj.obj ("#id_cart_box"); obj.innerhtml ="; This.refresh_price ();} This.cart_init = function () {}//commit, save to Cookiethis.cart_submit = function () {var obj = kj.obj ("#id_cart_box li");// Check if the order is ordered if (obj.length<1) {alert: Your shopping cart is empty, please order first! "); return false;} Whether the order price is up to the sending price if (this.mintotal>0 && this.total < this.mintotal) {alert ("Warm reminder: due to labor costs and other issues, the takeaway meal should be sent not less than" + this.mintotal+ "Yuan, the inconvenience also please you forgive! "); return false;} var i,val,j,arr_1=[];obj = Kj.obj ("#id_cart_box: cartid[]"); for (i = 0; i < obj.length; i++) {val = Kj.toint (Kj.obj (" #id_cart_num_ "+obj[i].value). Value); for (j=0;j
     
      0) x = x * -1;if (x > 0) {kj.set (obj, ' style.top ', top+ ' px '); Top+=val;window.settimeout ("Thisjs.showcart_time ('" + ID   + "'," + Top + "," + Top_target + "," + val + ")", 20); } else {kj.set (obj, ' style.top ', top_target+ ' px '); this.cart_lock = false;}}} Kj.onload (function () {thisjs.cart_init ();});
     

    Onmouseout= "Kj.delclassname (This, ' X_sel ');" onclick= "Thisjs.cart_add ({id: ' + ', Name: ' Hot and sour chicken giblets ', Pic: '/upload/attatch/ 2012/Hot and Sour chicken giblets rice _50_50.gif ', Price: ' 13.00 ', type: ' 6 '});


    What do you mean, ' 6 ' in this value?

    Where's the value of the transfer?
  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.