I am using opencart 2.3.0.2. I want to show checkout form directly on the Product page. The theme installed in Journal2. how can I do this?
Edit the files:catalog/view/theme/yourtheme/template/product/product.tpl and make the following modification:
Find the code:
if (json['success']) {
$('.breadcrumb').after('<div class="alert alert-success">' + json['success'] + '<button type="button" class="close" data-dismiss="alert">×</button></div>');
$('#cart > button').html('<span id="cart-total"><i class="fa fa-shopping-cart"></i> ' + json['total'] + '</span>');
$('html, body').animate({ scrollTop: 0 }, 'slow');
$('#cart > ul').load('index.php?route=common/cart/info ul li');
}
Replace With Below Code:
if (json['success']) {
window.location='index.php?route=checkout/checkout';
}
and then refresh modification cache from admin.
Go to admin > Extensions > Modifications and click on the blue Refresh button (top right corner) for update the system.and then check it. (If, have available any other cache option in your theme. also, it cache refresh.)
Related
I am showing position from django model like marker with popup:
my view file
<script>
const MAP_KEY = "{{ MAP_KEY }}";
const added_place_json = JSON.parse('{{ added_place_json | escapejs}}');
</script>
my js file
for (const place of added_place_json){
L.marker([place.fields.lat, place.fields.long]).bindPopup(
`<div class="card" style="width: 15rem;">\n` +
` <h6 class="card-header">Name place:<br>${place.fields.name}</h6>\n` +
` <div class="card-body">\n` +
` <p class="card-text" style="overflow: scroll">Place comment:<br>${place.fields.comment}</p>\n` +
` </div>\n` +
`</div>`
).addTo(map)
};
This works well on google chrome, but it doesn't work on safari. When I click on the marker in safari nothing happens
This is a bug of Leaflet 1.7.1, see Leaflet #7255
In the newest master version of leaflet it is working, see Issue Comment
So I recommand to change your leaflet-src from the Leaflet Release 1.7.1 to the master branch on Github
If for some reason you have to stick to 1.7.1 and you do not need to handle the 'taphold' event, initiating the map with tap: false might solve this issue for you.
(As suggested here https://github.com/Leaflet/Leaflet/issues/7331#issuecomment-742454380)
I am working in angular-9 , there are many things which works on reloading, but not after navigation. eg: there are two components A and B. and another component c have a reveal modal code(in foundation).
c component is to be included in both A and B.from component A through navigation I can move to component B which is a another page.
c.ts:
import { FormControl, Validators, FormBuilder,FormGroup, FormGroupDirective } from '#angular/forms';
loginFormControl:FormGroup;
ngOnInit() {
$('#loginModal').foundation();
this.loginFormControl = this.formBuilder.group({
phone_number: ''
});
}
c.html
<div class="reveal" id="loginModal" data-reveal>
<form class="loginForm" [formGroup]="loginFormControl"
(ngSubmit)="onSubmit()">
<input placeholder="Enter Mobile Number" formControlName="phone_number">
<button type="submit" class="button">LOGIN</button>
</form>
<button class="close-button" data-close aria-label="Close modal" type="button">
<span aria-hidden="true">×</span>
</button>
</div>
If I open the modal 'c' in both of the pages A and B on a click of two buttons on both pages with $('#loginModal').foundation('open'); in A.ts and B.ts files, it results me with some unexpected behavior.
1. the modal is open in both the pages. no issue related to view
2. But events of that modal(click,change) or if I enter phone number, It doesn't accept it from user. Even there no event works in a page until i refresh or reload the page.
3. After refreshing a page it will work on that page (including all
events and inputs), there won't be any issue in that page after reloading. but as i navigate to another component B, then it's(c) events and input won't work until i refresh this page too. this same will happen again with component A.
I haven't reach at any solution of this till now and why is this happening. Please let me know if anyone have solution of my problem. It would be fruitful for me.
I am trying to send tabs id to the the server from Django template. I want to send the selected tab's ID after submit the page. Is there any way to do that? Or How can I put my id into my url? Thank you in advance.
Here is my tab list:
<ul class="nav nav-tabs" role="tablist"˛id="myTab">
<li><i class="fa fa-sun-o"></i>MyFirstTab</li>
<li><i class="fa fa-cloud"></i>MySeconfTab</li>
</ul>
You could use Javascript (jQuery) to append the current tab ID to the form before it is submitted to the server. Something like this:
$(function() {
$( "#form" ).submit(function( event ) {
var currentTabID = $("ul#myTab li.active a").attr('id');
$('<input>').attr({
type: 'hidden',
name: 'currentTabID',
value: currentTabID
}).appendTo(this);
});
});
Then, in your Django view, you can access that data via request.POST.get("currentTabID")
My second button display strangely sometimes. Anyone encountered the same situation? any solutions?
The second button is a download function, coding as following:
downloadButton('downloadData', 'Export Keywords'),
I'm using the following style:
tags$head(
tags$link(rel = "stylesheet", type = "text/css", href = "bootstrap.css")
#tags$style(HTML('#run{background-color:orange}'))
),
I tried to specify the width and height under css file of the button class. After that, it shows:
I think the root of the problem is that the lable for the button is missing at run time. When comparing the html code, I found:
<button class="btn btn-default action-button btn-success
shiny-bound-input" id="runButton" type="button">Run Analysis!
</button>
<a id="downloadData" class="btn btn-default shiny-download-link
btn-success shiny-bound-output"
href="downloadData?w=" target="_blank"></a>
The problem is resolved after I remove following function from downloadHandler()
shiny::validate()
I'm using opencart 2.1.0.1, and use theme default .
I see at opencart inconvenience because it doesn't has button "Buy Now" skip add to cart.
Every body please help me, how to make button Buy Now for opencart
thanks you!
To change the button text edit catalog/language/english/english.php where it says:
$_['button_cart'] = 'Add to Cart';
If you are using multiple languages, edit other paths accordingly.
To redirect to cart you can edit the file: /catalog/view/theme/default/template/product/product.tpl and look around line 466 to find this:
if (json['success']) {
$('.breadcrumb').after('<div class="alert alert-success">' + json['success'] + '<button type="button" class="close" data-dismiss="alert">×</button></div>');
$('#cart > button').html('<i class="fa fa-shopping-cart"></i> ' + json['total']);
$('html, body').animate({ scrollTop: 0 }, 'slow');
$('#cart > ul').load('index.php?route=common/cart/info ul li');
}
Change it to add a redirect and comment out the other stuff like this:
if (json['success']) {
window.location.href = 'index.php?route=checkout/cart';
//$('.breadcrumb').after('<div class="alert alert-success">' + json['success'] + '<button type="button" class="close" data-dismiss="alert">×</button></div>');
//$('#cart > button').html('<i class="fa fa-shopping-cart"></i> ' + json['total']);
//$('html, body').animate({ scrollTop: 0 }, 'slow');
//$('#cart > ul').load('index.php?route=common/cart/info ul li');
}
If you want this to work in category and search lists you need to make the same edit in /catalog/view/javascript/common.js around line 153.