| ||||||||||
Shopping cart software Solutions for online shops and malls | ||||||||||
|
X-Cart Home | FAQ | Forum rules | Calendar | User manuals | Login |
Best way to query variables in 5.3 | |||
|
|
Thread Tools | Search this Thread |
#1
|
|||||||
|
|||||||
Best way to query variables in 5.3
Hello,
I have a tracking code for the homepage and the receipt page that needs the order total and order number if they exist. What's the best way to get these values in a 5.3.x twig file? Thanks!
__________________
X-Cart Gold 4.4.5 X-Cart Ultimate 5.2.22 X-Cart Business 5.3.2.13 X-Payments 3 |
|||||||
#2
|
|||||||||
|
|||||||||
Re: Best way to query variables in 5.3
It depends on the twig file. For each twig template there is a PHP "widget" class that retrieves data and provides methods for the template to read it. If there is no method in the widget class, the template will look for a method in the controller class.
What twig file you want to show the data? Is it a custom one? If so, how did you add it to the home page? And what is the data?
__________________
Alex Solovev, Qualiteam --- User manual Video tutorials X-Cart FAQ You are welcome to press "Thanks" button if you find this post useful Click here to learn how to apply patches X-Cart Extensions |
|||||||||
#3
|
|||||||
|
|||||||
Re: Best way to query variables in 5.3
I'm planning on putting an affiliate tracking code in a footer twig file since we may need to modify it to show up on other pages in the near future. It will only ever need to be present on the product, category, home, and checkoutSuccess pages. For now I'll use this.getTarget() as a selector. This twig file seems to work well for that:
customer/layout/footer/main.footer.section.twig The data that we need to query is the current order number and subtotal amount of the cart. I'm not sure at what point the order number is generated, but we can just pass a blank value until it is generated. Is there a widget call or global variable I can call to pull this data? Thanks!
__________________
X-Cart Gold 4.4.5 X-Cart Ultimate 5.2.22 X-Cart Business 5.3.2.13 X-Payments 3 |
|||||||
#4
|
|||||||
|
|||||||
Re: Best way to query variables in 5.3
So spending about 5 seconds on Google shows me how to get cart totals in mode widely adopted shopping carts.
Magento: Code:
or Woocommerce: Code:
But apparently to grab common order or cart data in the X-Cart, the calls vary from twig to twig file? I couldn't find any documentation or community support covering it, so my only options are to painfully reverse engineer even the most trivial tasks? Or is there an object that allows me to pull out variable data from whatever twig file I want to display it? Any direction is greatly appreciated!
__________________
X-Cart Gold 4.4.5 X-Cart Ultimate 5.2.22 X-Cart Business 5.3.2.13 X-Payments 3 |
|||||||
|
|||
X-Cart forums © 2001-2020
|