Add back button in checkout page of OpenCart - opencart

I want to add back button in checkout page to redirect to the cart page. Which file has to be modified?

In your catalog/controller/checkout/checkout.php file add the line below to index() function :
$data['back_to_cart'] = $this->url->link('checkout/cart');
In your checkout.tpl wherever you need the back button add this line:
Back

Related

Put request.path to a url parameter in Django template

I want to create a back button to a page which can be accessed with a link from another page. To do this, I want to put the first page's path to the link, and on the next page I can put it to the back button.
I have this anchor tag:
Go to page
When I try to go to the site I get the following error:
Reverse for 'page' with keyword arguments '{'path': '/my_site/'}' not found. 1 pattern(s) tried: ['notifications\\/(?P<path>[^/]+)\\Z']
If you know the url name of the first page,
path('first_page/', views.first_page, name='first_page'),
then you can simply use:
Go the page
Otherwise, you must add the url of the previous page to the context of the second page's template in order to use that in that template. How to do that depends on your style. For instance, you can somehow keep a log of the visited pages on the client side or server side, and use that collection to determine the previous page.

Oracle Apex How to display page item as url

I have a page item which stores URL.
How do i change its type to URL so that the link becomes clickable.
As of now, there is page subtype url, but setting it doesn't make any difference.
Apex 21.1
A text field is an html input element, that will display text only, you probably could write some javascript to open whatever is in the page item in an url but that is confusing functionality. What should happen if the user clicks in the input element ? Should it open the link or should the user be editing the value ?
This is a possibility.
Create a page item on your page, say P1_URL
Add the following in the "Post Text" attribute of the page item (style it to your own preference):
<span class="fa fa-external-link" aria-hidden="true"></span>
Add a dynamic action on change of the element P1_URL with a true action of "Execute Javascript Code" and the following code:
$("#myurl").attr("href", apex.item( "P13_URL" ).getValue())
Check "Fire on Initialization" for the true action.
That is all there is to it, now when you add something in the page item P1_URL and click the link, it will open the that url in a new window.
UPDATE: Technique for read only text field.
For a read only text field, the input element is hidden and an additional span element is rendered with an the page item name as id, suffixed by _DISPLAY. The trick is to grab the content of that span element and add an anchor with attributes. This can be done with an onload dynamic action:
Create a page item on your page, say P1_URL, set it to "Read-Only: Always"
Add a dynamic action on Page Load with a true action of "Execute Javascript Code" and the following code:
let itemVal = $("#P1_URL_DISPLAY").text()
$("#PP1_URL_DISPLAY").html(`<a href='${itemVal}' target='_blank'>${itemVal}</a>`)
Make sure that when you copy this, the quotes are exactly the same: the outer quotes are backticks, those are needed for the ES6 syntax.
Note: check the page documentation for the subtype url - it explains exactly what it does.

Setting session variable on click

I've got a popup message with a close button at the top. If the user clicks the close button, they should never see the message again while on the site. If they don't click the close button, they will see it on the top of each page on the site.
When the user clicks the close button, I want to set request.session['promo'] to 0. On subsequent page loads on the site, if request.session['promo'] == 0, I will not show the popup message.
What is the best way of setting a session variable on click in django?
Thanks for the direction!
In HTML OnClick of button just call a function in views.py
Ex:
IN HTML :<Button onclick={% your_fucntion %}></button>
IN VIEWS.PY :
def your_fucntion(request):
request.session['promo'] == 'your_variable'
for getting variable :
promo = request.session['promo']

Opencart product.tpl

Where did I miss to add a line of code if I try to echo php variable inside OPENCART product.tpl file and it doesn't show up on site?
Notes: there is a field in database. I am able to save to this field from admin panel ( i added a custom field there).
Did You edit also the product controller to load the variable and pass it to the template? I guess not... Edit catalog/controller/product/product.php and add $this->data['MYVARIABLE'] = $product_info['MYVARIABLE']; somewhere before $this->render() is called.

How do I change the template of the Mailchimp Wordpress widget?

I want to change how the form looks like and the labels on the fields of the form.
Login in as Admin and then, under the Plugins area in the sidebar, click Editor. There's a dropdown menu labeled "Select plugin to edit". Click that and select "MailChimp" and then click the "Select" button. The sidebar widget form is called mailchimp/mailchimp_widget.php
The form's code begins right after the first PHP block.
You can also edit the code directly by looking in the wordpress/wp-content/plugins/mailchimp/ directory. The translations are in the po sub-directory.
The trick with this template is that the fields are loaded from elsewhere. In order to change the label, you have to set the option of the fields in the PHP code. Each field is looped through and printed out automatically.
For example to change the "Email Address" label to read "Email" add the following code at the end of the first PHP block:
$mv[0]['name'] = 'Email';
This assumes that the first field that will be printed out is the Email Address field. You can do a var_dump to see what other options are available.
If you want to make more drastic changes to the form, remember that when the widget is updated, you'll have to make the changes again and merge them with the updated version.