Post by driveshafts » Fri Mar 18, 2022 3:57 pm

Hey guys,
I would like to change the product name in the 'Success: You have added" message to model instead.
Please can someone how me where this is stored. i have been searching for days now.

Default is 'Success: You have added 'product' to your cart
I would like : 'Success: You have added 'model' to your cart.

Any guidance please.
OC 3.0.3.2
Last edited by driveshafts on Mon Mar 21, 2022 4:34 pm, edited 1 time in total.

Newbie

Posts

Joined
Fri Mar 18, 2022 3:17 am

Post by Gergely » Fri Mar 18, 2022 6:16 pm

Hi driveshafts,

That requires just a minor modification in catalog/controller/checkout/cart.
Change

Code: Select all

$json['success'] = sprintf($this->language->get('text_success'), $this->url->link('product/product', 'product_id=' . $this->request->post['product_id']), $product_info['name'], $this->url->link('checkout/cart'));
to

Code: Select all

$json['success'] = sprintf($this->language->get('text_success'), $this->url->link('product/product', 'product_id=' . $this->request->post['product_id']), $product_info['model'], $this->url->link('checkout/cart'));
(Change $product_info['name'] to $product_info['model'])
This can be done in an OCMOD with:

Code: Select all

<file path="catalog/controller/checkout/cart.php">
    <operation error="skip">
        <search regex="true"><![CDATA[
            ~(\$json\['success'\].*\$product_info\[)'name'(\].*;)~
        ]]></search>
        <add><![CDATA[
            $1'model'$2
        ]]></add>
    </operation>
</file>
Please find attached an installer that does exactly that.

Hope this helps,
Gergely

Attachments


Active Member

Posts

Joined
Wed Sep 30, 2020 7:58 pm

Post by driveshafts » Fri Mar 18, 2022 6:26 pm

Just wow!!
Gergely you are amazing, that worked perfectly. I really do appreciate it. Can i pay you for this?

Newbie

Posts

Joined
Fri Mar 18, 2022 3:17 am

Post by paulfeakins » Fri Mar 18, 2022 8:46 pm

driveshafts wrote:
Fri Mar 18, 2022 6:26 pm
Just wow!!
Gergely you are amazing, that worked perfectly. I really do appreciate it. Can i pay you for this?
If this is now fixed, please add [SOLVED] to the start of this post title.

UK OpenCart Hosting | OpenCart Audits | OpenCart Support - please email info@antropy.co.uk


User avatar
Guru Member
Online

Posts

Joined
Mon Aug 22, 2011 11:01 pm
Location - London Gatwick, United Kingdom

Post by Gergely » Fri Mar 18, 2022 11:38 pm

Helping with minor tweaks like that is just my way of giving back to the community, so your expressed appreciation is more than enough for the effort I've put into this. Glad to have been of assistance!
driveshafts wrote:
Fri Mar 18, 2022 6:26 pm
Just wow!!
Gergely you are amazing, that worked perfectly. I really do appreciate it. Can i pay you for this?

Active Member

Posts

Joined
Wed Sep 30, 2020 7:58 pm

Post by by mona » Fri Mar 18, 2022 11:49 pm

:ok:

Thanks Gergely
Hey guys,
I would like to change the product name in the 'Success: You have added" message to model instead.
Please can someone how me where this is stored. i have been searching for days now.

Default is 'Success: You have added 'product' to your cart]
I would like : 'Success: You have added 'model' to your cart.

Any guidance please.
OC 3.0.3.2
OC version posted
OC default
Clear description of what is required

and the please helps .. the thank you helps also
Well done driveshafts I am glad you have this sorted ;)
If you could just follow what Paul wrote earlier that would be perfect - it is customary to edit the title as solved so as anyone searching google in future will find this post and will know there is a solution

DISCLAIMER:
You should not modify core files .. if you would like to donate a cup of coffee I will write it in a modification for you.


https://www.youtube.com/watch?v=zXIxDoCRc84


User avatar
Expert Member

Posts

Joined
Mon Jun 10, 2019 9:31 am

Post by ru-lefthanded » Thu May 19, 2022 10:30 pm

Running OC3.03.2
Would like to remove the success you have added xxx pop up completely (the one that pops up if you add to cart from the category menu for example) - is it just a case of removing the following from cart.php

if (isset($this->session->data['success'])) {
$data['success'] = $this->session->data['success'];

unset($this->session->data['success']);
} else {


- or
1) Am I looking in the wrong place - if so, where do I find the file(s)!
2) Do I need to change more files - if so can you confirm details please!

New member

Posts

Joined
Tue Sep 03, 2013 3:39 am
Who is online

Users browsing this forum: ravikumar22, Semrush [Bot] and 82 guests