Jump to content

Printing / debuging values in prestashop 1.7


Recommended Posts

Hi, 

I am new to prestashop 1.7 version, so I have some basic queries. Please some one help on it.

1. In prestashop 1.6, there are p() and d() functions written in tools.php but when I checked in prestashop 1.7 there is no such functions and it is throwing me error. If it is not there some alternatives will be using by prestahop 1.7. Can you guys please explain on this?

2. Will override works same as in prestashop 1.6?

3. Can we use symphony template same like smarty?

It would be really helpful for me.

Link to comment
Share on other sites

Well a lot of 1.7.4.2 is php variable controlled thru ajax arrays. So its very complicated to See what is in a variable.

The best way to do it for me is to add a  tag  in your  footer partial tpl that basically says

<span class="value"> {$phpvariable.your.curious.about} </span>

The data model in 1.7.4.2 is using more of a Code behind C# design that I really cant put my finger on why I understand it...other then WP forms and UWP  MVC programming.

Basically you have a variable $Cart

Now you have a property of $Cart called Total

Total has 2 properties for example.

Label

Value

So when an ajax call is called to the completely anonymous  functions in the JS file( which is maddening)  they are using React? or maybe just angular to return  the property field in an json array.

 

To display them, the variable is no longer $cart = "empty";

it becomes.

$Cart.Total.Label.Value = " Items in Cart"

I wrote this from home pc which does not have a PS folder to look at for live examples, but in 1.7.42 you need to know two or three things. TPL's display data often times OLD model data and the variables inside { $ } needs to adjusted for this model. The .php file in the controller creates the data model and the really funky ajax calls with unknown react or angular syntax( as i do not know either framework) fills the TPL's variable on the fly.

 

In truth is is very much like a model view controller  in C# but since the Ajax is doing the fills via json arrrays.. things get muddy quick.

 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...