https://mammothworkwear.com/safety-boots/
I want to locate a product item in that link and click it.
The page object looks like:
elements: {
menuItem: 'nav[role="navigation"] ul li a',
productItem: 'main .pitem a'
},
clickProductItem: function(containingText) {
return helpers.clickHiddenElement(page.mammothWorkwear.elements.productItem, containingText);
},
With these code, the product item cannot be located. Any idea? thanks.
Related
I need to show a warning popup button when the user presses the "Checkout" button (just an ok/dismiss button)
I avoid using raise Warning() or raise ValidationError() since I want to remain on the existing page and simply show a pop-up warning.
Can you please share the simplest way to do this in Odoo 13?
On click proceed checkout button called jsonRpc where call your json controller with that add your custom logic on the controller and return that and on the js check with your condition and raise your Dialog-Box Like this,On Js:
var Dialog = require('web.Dialog');
ajax.jsonRpc("/custom/url", 'call', {}).then(function(data) {
if (data) {
var dialog = new Dialog(this, {
size: 'medium',
$content: _t("<div style='font-size:14px;font-family:Helvetica, Arial, sans-serif;'>Error.</div>"),
buttons: [{
text: _t('Ok'),
classes: "btn-primary",
close: true
}],
}).open();
} else {
// odoo logic
}
});
Thanks
I am using Shopify BuyButton.js to create a buy button and shopping cart on my site.
I have a product with multiple variants.
I can easily create a buy button for a product with the following:
ui.createComponent('product', {
id: [productid],
node: document.getElementById('container'),
options: {
product: {
layout: 'horizontal',
contents: {
img: false,
title: false,
options: true
}
},
cart: {
startOpen: false,
}
}
});
This product has several variants that can be chosen with a drop down and the first variant is the selected one.
What I want to do is create a buy button but only for a specific variant of the product. No drop down and clicking 'Add to Cart' will add that product with the specific variant selected.
I can hide the drop down by setting options: false but the variant selected is the first one and I can't set the specific variant.
Under your line id: [productid], put in:
variantId: [variantid],
Where variantid is ID of the variant. This can be found in the URL when you click to edit the variant in the Shopify dashboard.
I want to render web page in my app using in-App-Browser.
that page should display in ion-content section
Is there any way, I can open it. I will really appreciate some help.
Thanks.,
You're supposed to share the code you have so far.
I thought that this would be solved by an iFrame but it sounds like the ios store might not approve of that method.
While researching I found this:
Ionic 4 InAppBrowser for third party payment solution | umeaworks
Which talks about how they did it. It seems pretty standard:
openBrowser(url: string, target: string) {
const browser: InAppBrowserObject = this.theInAppBrowser.create(url, target, this.options);
const btn: HTMLElement = this.hiddenBtn.nativeElement as HTMLElement;
if (browser.on('loadstop')) {
browser.on('loadstop').subscribe((ev: InAppBrowserEvent) => {
// do whatever is needed here, for example check the url of the browser event
if (ev.url) {
// do stuff based on url and url parameters
// in our solution we got an order id from a confirmation page
}
// for the event to trigger we added a hidden button to interact with the screen
btn.click();
});
}
}
With these options:
options: InAppBrowserOptions = {
location: 'yes',
hidden: 'no',
clearcache: 'yes',
clearsessioncache: 'yes',
zoom: 'yes',
hardwareback: 'yes',
mediaPlaybackRequiresUserAction: 'no',
shouldPauseOnSuspend: 'no',
closebuttoncaption: 'Close',
disallowoverscroll: 'no',
toolbar: 'yes',
enableViewportScale: 'no',
allowInlineMediaPlayback: 'no',
presentationstyle: 'pagesheet',
fullscreen: 'yes',
footer: 'yes'
};
The article also notes that a workaround was needed - triggering a fake button press to give focus to the screen otherwise it wouldn't run properly:
<ion-button #hiddenBtn style="display:none">hidden</ion-button>
and:
#ViewChild('hiddenBtn') hiddenBtn: ElementRef;
If this doesn't solve your answer, please update your question with details about what you have tried and what specifically went wrong.
i have a grid panel with a column that if you click you downalod a file associate to this row.
In extjs 2 i just define a new renderer that is a function who return only return the String format of an url like this:
function DownaloadFile(value, metadata, record, rowIndex, colIndex, store)
if (record.data.id){
return String.format('<b><img src="<c:url value="/icons/icon_download.gif"/>"/></b>',record.data.id);
}
This syntax is not rigth in ExtJS4.2 because String.format is now Ext.String.format but when i made this change nothig happens.
I try to use the new actioncolumn in the column definition in this way:
{
xtype:'actioncolumn',
text: "download",
width:80,
items: [{
sortable: false,
align:'center',
iconCls: 'download_icon',
hrefTarget: '_blank',
handler: function(grid, rowIndex, colIndex) {
var rec = reportPanel.getStore().getAt(rowIndex);
return Ext.String.format('<b></b>',rec.id);
}
}]
}
but something is wrong because javascript debugger doesn't made any type of error.
Thanks in advance.
The handler property of actioncolumn (witch renders an icon, or a series of icons in a grid cell, and offers a scoped click handler for each icon) is documented as:
A function called when the icon is clicked.
Consider using the templatecolumn (witch renders a value by processing a Model's data using a configured XTemplate) instead and passing it a tpl property.
I'm trying to create programatically an EnahncedGrid with a menu. I've got the grid to work, but I've been unable to use the menu. It just not shows up. The code is as follows:
<script>
sMenu = new dijit.Menu({});
sMenu.addChild(new dijit.MenuItem({
label: "Delete Record",
iconClass: "dijitEditorIcon dijitEditorIconCancel",
onClick : function(){
alert(1);
}
}));
sMenu.startup();
/**
* El grid propiamente dicho
*/
var grid = new dojox.grid.EnhancedGrid({
id: "grid_"+i,
query: {
idDocument: '*'
},
plugins: {
nestedSorting: true,
indirectSelection: true,
menus: {rowMenu:sMenu}
},
onRowDblClick: openFile,
structure: layout
})
</script>
Any idea what I'm doing wrong?
I haven't used this myself, but I have two possible suggestions:
First, make sure you're dojo.require-ing "dojox.grid.enhanced.plugins.Menu" and are only instantiating the widgets within a dojo.addOnLoad or dojo.ready.
If you've already done that, the second thing I'd suggest is giving your menu an id, and passing that id to the rowMenu property of the menus object (in other words, pass a string, not the widget itself). Although, the way you're doing it seems like it should work, judging from the code.
You can see a test page with working menus here: http://archive.dojotoolkit.org/nightly/dojotoolkit/dojox/grid/tests/enhanced/test_enhanced_grid_menus.html