Post by digixoe » Wed Sep 02, 2020 7:36 pm

I'm trying to modify the product's add to cart page
I modified the twig page successfully which is : /catalog/view/theme/{theme_name}/template/product/product.twig
In the product.twig the jquery event for adding to cart has this url : index.php?route=checkout/cart/add
I thought this link of the route was for the Controller /catalog/controller/checkout/cart. I changed the function add in this controller but I can't see any result.
I cleared the cache, also the modifications from the extensions without any result.
Maybe it's a cache issue, or I'm completely wrong with the Controller.
Please Note : I tried this in local setup and its working.
So how can i do ?
Version : 3.0.3.6

Newbie

Posts

Joined
Sun Jun 21, 2020 1:49 am

Post by letxobnav » Wed Sep 02, 2020 8:05 pm

well, that is the right function in the right controller so it all depends on what you did and what you expect, I have no idea.

Crystal Light Centrum Taiwan
Extensions: MailQueue | SUKHR | VBoces

“Data security is paramount at [...], and we are committed to protecting the privacy of anyone who is associated with our [...]. We’ve made a lot of improvements and will continue to make them.”
When you know your life savings are gone.


User avatar
Expert Member

Posts

Joined
Fri Aug 18, 2017 4:35 pm
Location - Taiwan

Post by digixoe » Wed Sep 02, 2020 8:10 pm

I added this on the top of the function

Code: Select all

	public function add() {
        $this->response->addHeader('Content-Type: application/json');
        $this->response->setOutput(json_encode(["n"=>"n"]));
Nothing happened

Newbie

Posts

Joined
Sun Jun 21, 2020 1:49 am

Post by letxobnav » Wed Sep 02, 2020 8:17 pm

and you were expecting what exactly?

Crystal Light Centrum Taiwan
Extensions: MailQueue | SUKHR | VBoces

“Data security is paramount at [...], and we are committed to protecting the privacy of anyone who is associated with our [...]. We’ve made a lot of improvements and will continue to make them.”
When you know your life savings are gone.


User avatar
Expert Member

Posts

Joined
Fri Aug 18, 2017 4:35 pm
Location - Taiwan

Post by digixoe » Wed Sep 02, 2020 8:23 pm

I'm expecting to get the json array { "n":"n"} only for testing purposes.
But it working as never touched the file. It checking the required fields and showing the errors...

( I'm trying to implement a sub options solution where I don't want to check more than an error. Only one option is enough )

Newbie

Posts

Joined
Sun Jun 21, 2020 1:49 am

Post by letxobnav » Wed Sep 02, 2020 8:35 pm

listen, no offence but if you have an issue with some OC code, fine, but if you are just fiddling around with some code to see what happens when you do this or that then stop wasting other people time.
in short.

Code: Select all

        $this->response->addHeader('Content-Type: application/json');
        $this->response->setOutput(json_encode(["n"=>"n"]));
that does not end the add function, it just keeps on going and in the end your n:n output will be overwritten by the regular $this->response->setOutput.
If you want it to end there, add a return;

Crystal Light Centrum Taiwan
Extensions: MailQueue | SUKHR | VBoces

“Data security is paramount at [...], and we are committed to protecting the privacy of anyone who is associated with our [...]. We’ve made a lot of improvements and will continue to make them.”
When you know your life savings are gone.


User avatar
Expert Member

Posts

Joined
Fri Aug 18, 2017 4:35 pm
Location - Taiwan

Post by digixoe » Wed Sep 02, 2020 8:47 pm

No I'm not playing with anything. I have a company and I'm trying to do the thing which my customer want. I never played with people time because I know the time for everyone is valuable.
Maybe I can't explain correctly my problem because my ENG as you can see is not enough..
So, I added this code to controller :

Code: Select all

        $this->response->addHeader('Content-Type: application/json');
        $this->response->setOutput(json_encode(["n"=>"n"]));
        return; // <-- I added this before without any result...
for a simple check to see what this controller will return. Because I'm not getting the above response although the PHP code changed in the controller.
I have really problem with OC code. Hope I can explain myself.
I'm using A REST client to check the response

Newbie

Posts

Joined
Sun Jun 21, 2020 1:49 am

Post by digixoe » Wed Sep 02, 2020 8:56 pm

So I finded the solution. It wasn't from OC code but from the server. After a restart not it's working.

Newbie

Posts

Joined
Sun Jun 21, 2020 1:49 am

Post by paulfeakins » Thu Sep 03, 2020 7:23 pm

digixoe wrote:
Wed Sep 02, 2020 8:56 pm
After a restart not it's working.
Presumably you mean "now".

If so please add [SOLVED] to the beginning of the post title.

For quick, professional OpenCart support please email info@antropy.co.uk


User avatar
Guru Member

Posts

Joined
Mon Aug 22, 2011 11:01 pm
Location - Reigate, Surrey, United Kingdom
Who is online

Users browsing this forum: No registered users and 35 guests