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.
Related
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")
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.)
I have a form component where I used it for adding and editing. However there is a problem not sure how to address it
<button *ngIf="!editMode" ion-button type="submit" [disabled]="!experienceForm.valid" (click)="save(experienceForm)">
Save
</button>
<button *ngIf="editMode" ion-button type="submit" [disabled]="!experienceForm.valid" (click)="update(experienceForm)">
Update
</button>
the above code is self explanatory. Not forget to mention, if the form is for editing, I have populated the fields using ngModel so that the user can edit.
The update button shouldn't be disabled if the form is valid(meaning all fields currently valid)..but as far as I tested , this !experienceForm.valid is not working when the form is called for EDITING , if I replace it with any of attributes touch or dirty, like [disabled]="!experiencForm.dirty" then its working. but somehow valid does not trigger unless I re-input all the fields.
how to address this issue! Below I have provided a sample of all the code:
.ts:
constructor(...){
this.userId = navParams.get('userId'); // get passed params
this.userExp = navParams.get('userExperience'); // get passed params
this.experienceForm = this.formBuilder.group({
myInput1 : ['', Validators.required],
myInput2: ['', Validators.required]
}
ionViewDidLoad(){
if(this.userExp !== 'null'){ // if not null , then Its for editing
this.editMode = true;
this.myInputModel1 = this.userExp.value; // populating the fields
this.myInputModel2 = this.userExp.value;
}
}
.html: // !experience.valid does not trigger here for the button Update
<form [formGroup]="experienceForm" novalidate>
<ion-item>
<ion-label class="labels" floating>First</ion-label>
<ion-input type="text" formControlName="myInput1" [(ngModel)]="myInputModel1"></ion-input>
</ion-item>
///
<button *ngIf="!editMode" ion-button type="submit" [disabled]="!experienceForm.valid" (click)="save(experienceForm)">
Save
</button>
<button *ngIf="editMode" ion-button type="submit" [disabled]="!experienceForm.valid && !experienceForm.dirty" (click)="update(experienceForm)">
Update
</button>
</form>
It is better to not use formControlName and ngModel together. You can assign form values as
ionViewDidLoad(){
if(this.userExp !== 'null'){ // if not null , then Its for editing
this.editMode = true;
this.experienceForm = this.formBuilder.group({
myInput1 : [this.userExp.value, Validators.required],
myInput2: [this.userExp.value, Validators.required]
});
}
I think this will solve your problem
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 want to add tooltips onto a button in a component that can appear based on a set of results back from the server. (i.e. action buttons for delete, edit etc.)
I have created a “search” component that is rendering into the application and when a search button is clicked the server may return a number of rows into that same search component template.
so for example:
My-app/pods/factual-data/template.hbs
Contains:
…
{{#if results}}
<div class="row">
<div class="col-sm-3"><b>Factual ID</b></div>
<div class="col-sm-2"><b>Name</b></div>
<div class="col-sm-2"><b>Town</b></div>
<div class="col-sm-2"><b>Post Code</b></div>
<div class="col-sm-2"><b>Actions</b></div>
</div>
{{/if}}
{{#each result in results}}
<div class="row">
<div class="col-sm-3">{{result.factual_id}}</div>
<div class="col-sm-2">{{result.name}}</div>
<div class="col-sm-2">{{result.locality}}</div>
<div class="col-sm-2">{{result.postcode}}</div>
<div class="col-sm-2">
<button {{action "clearFromFactual" result.factual_id}} class="btn btn-danger btn-cons tip" type="button" data-toggle="tooltip" class="btn btn-white tip" type="button" data-original-title="Empty this Row<br> on Factual" ><i class="fa fa-check"></i></button>
</div>
</div>
{{/each}}
…
However I cannot get the tooltip code to function, due to an element insert detection/timing issue..
In the component
My-app/pods/factual-data/component.js
Contains:
...
didInsertElement : function(){
console.log("COMPONENT: didInsertElement");
Ember.run.scheduleOnce('afterRender', this, this.afterRenderEvent);
this.enableToolTips();
},enableToolTips: function() {
var $el = Ember.$('.tip');
console.log("TOOLTIP:", $el);
if($el.length > 0) {
$el.tooltip({
html:true,
delay: { show: 250, hide: 750 }
});
}
}
...
However it seems didInsertElement is only run when the component is first rendered, is there a different function that is called everytime something in the DOM is changed within a component?
I did try to use observes: i.e.
…
enableToolTips: function() {
var $el = Ember.$('.tip');
console.log("TOOLTIP:", $el);
if($el.length > 0) {
$el.tooltip({
html:true,
delay: { show: 250, hide: 750 }
});
}
}.observes('results')
…
Which does trigger when the results variable is changed however it is still triggering before the content is actually rendered. I am assuming this because is I manually run in the console Ember.$('.tip').tooltip() (after the button is displayed) then the tooltips work ok.
Any pointers on this issue?
Try
enableToolTips: function() {
Ember.run.scheduleOnce('afterRender', this, function() {
var $el = Ember.$('.tip');
console.log("TOOLTIP:", $el);
if($el.length > 0) {
$el.tooltip({
html:true,
delay: { show: 250, hide: 750 }
});
}
});
}.observes('results')
Checking Ember.Component API there are two hooks that can do that
willClearRender : When component html is about to change.
willInsertElement : When old html is cleared and new one is going to be placed.
But you need to have a look on scheduleOnce.
Its worth noting that didInsertElement runs every time. But when it runs view was not updated. To solve that you need to run your code inside a Run Loop like this
didInsertElement : function(){
var self = this;
Ember.run.scheduleOnce('afterRender', this, function(){
//run tool tip here
self.$().find(".tip").tooltip({
});
});
}