php - What is the correct method to wrap a heap of code into a variable -


I am working with Shopping Cart script which does not allow me to add php to template files. The method used to create $ globilus inside class files and calling them with TPL files. The following is what I should do.

$ Global ['DiscountPrice'] must be equal to that part of the code as follows. I tried and tried some syntax options to wrap it, but it breaks because the same syntax is used inside the part of the code. $ Globals [ 'discountedprice'] = $ query = mysql_query ( "SELECT * FROM isc_customer_group_discounts WHERE` catorprodid` = '%% GLOBAL_ProductId %%' and 'Kstmgrgrup` = 1 and` Diskounttaip' = 'PRODUCT'); $ Discounted_price = ' '; while ($ proddisc = mysql_fetch_array ($ query)) {$ discperc = $ proddisc [' 4 ']; $ Diskmeth = $ proddisc [' 6 ']; if ($ discmeth =' percentage ') {$ discperc = $ proddisc [ '4'] / 100; $ Discounted_price = $ row [ 'prodprice'] * $ discperc; $ global [ 'discount went Price'] = $ discount amount;} else ($ diskmeth = 'price') { $ Discounted_price = $ row [ 'prodprice'] - $ discperc; $ global [ 'amount discount prices went'] = $ discount;} else ($ diskmeth = 'fixed') {$ discounted_price = $ discperc; $ Gl The ['discounted price'] = '$ amount discounted;}};

 

Edit. Probably I have not fully considered the question, but if you want to consistently join the string then what do you want to do? / P> $ discounted_price = ''; // You start with an empty string ($ proddisc = mysql_fetch_array ($ query)) {$ discperc = $ proddisc ['4']; $ Diskmeth = $ proddisc ['6']; If ($ diskmeth = 'percent') {$ discperc = $ proddisc ['4'] / 100; $ Discounted_price = $ line ['prodprice'] * $ discperc; // And now you have a new price $ globals ['DiscountPrice'] to contact. $$ Discounted_price; } Otherwise ($ diskmeth = 'price') {$ discounted_price = $ line ['prodprice'] - $ diskperc; $ Global ['discountprice']. $$ Discounted_price; } Otherwise ($ diskmeth = 'fixed') {$ discounted_price = $ discperc; $ Global ['discountprice']. $$ Discounted_price; }};

Comments