BigCommerce, How to add a custom quick view button - bigcommerce

BigCommerce, How to add a custom quick view button anywhere other than the one that shows on hover like in code?
<div class="ProductImage QuickView" data-product="%%GLOBAL_ProductId%%">
%%GLOBAL_ProductThumb%%
</div>

It's been 4 months since your original post so I'm not sure if you need this anymore, but others might find it useful.
In your CategoryProductsItem.html you can insert the following code
<style>.QuickView.yourClass .QuickViewBtn{background-color:transparent !important;} .Quickview.yourClass{position:relative; display:block; padding:0;}</style><div class="QuickView yourClass btn Small icon-Add To Cart" data-product="%%GLOBAL_ProductId%%" style="display:block !important; visibility: visible;">Add to cart</div>
I use this to basically give the customer the ability to change quantities in the add to cart popup(which is actually now just using the quick view one).
The QuickViewContent.html is where you could add in the product description if you wanted with
%%GLOBAL_QuickViewProductDescription%%
the visibility and block properties are important so aren't forced to hover for the button to be visible

Related

interactjs drag stops after few events

I just had a heavy problems with a vue cli project with interactjs
the latest version is installed
"interactjs": "^ 1.10.3",
I use in vue https://github.com/kimuraz/vue-interact
Now I have the following problem, in a dummy project I have a component from which several multitouch elements can be created, these can be scaled, rotated, sorted ... all of them work wonderfully with dummy content.
in a real project I have a div that acts as a container for a scrollable content, suddenly the drag in this area no longer worked. At first I thought it was because of the container/scollable div combination, but when I remove the container the problem remained.
The problem currently occurs when the element loaded into the slot is a text element with a few lines of text. with 2-3 lines it can be moved on the text, if there are more lines the drag start and move event will be triggered, the move only a few times. so the window can be moved a bit.
what can it be, how can i handle it?
here the simple structure of the component:
<div :style="scaleRotateStyle" ref="scaleit" class="scale-element" v-show="isWindowActive == true" #mousedown="touchDown">
<div class="window-content-back" ref="content">
<div class="window-content-scroll">
<div class="window-content">
<slot :idNr="idNr" ></slot>
</div>
</div>
</div>
</div>
edit: after further testing I come to the following conclusion:
it is due to the overflow-y: auto of the scroll container.
.window-content-scroll {
...
overflow-y: auto;
overflow-x: hidden;
...
}
if I set this property to hidden I can touch it anywhere as usual.
what options do i have?
Pack the class '.window-content-scroll' in ignoreFrom within interact.js. Unfortunately, the entire content area is then no longer draggable, I thought I could move the window horizontally ...
scrolling the window content via javascript, does that make sense, is there a good example?
maybe someone has a nice idea?
Closing the loop for others who might find this: touch-action: none; worked for me, as suggested in #Shmack's comment. Was working with mouse, not touch.

How can I change the styleClass of a control while also doing a partial refresh on another component?

I have a straightforward XPage that lets a user answer a question with a simple Yes/No/NA response using radio buttons. I have restyled the radio buttons to look like a bootstrap button group to make it visually more interesting for the user. If the user chooses "Fail" then they are informed that they need to do something else - easily done with a simple partial refresh to a div further down the page.
This all works fine.
The problem I'm having is that I'd like it so that when the user selects an option, I would like to add a new class of "active" to the selected option so that it highlights in a pretty colour. But for the life of me I can't get this to work and though I'm sure it's a straight forward problem, I can no longer see the wood for the trees.
My current (abridged) iteration of the radio button code is this:
<xp:div styleClass="btn-group item-result" id="edit-result" loaded="${Question.open}">
<xp:radio text="${lbl.kwPass1}" id="itemPass"
styleClass="btn btn-pass #{(item.itemResult eq '0')?'active':''}" groupName="itemResult"
selectedValue="1">
<xp:eventHandler event="onchange" submit="true"
refreshMode="partial" refreshId="actionAlert">
<xp:this.script><![CDATA[XSP.partialRefreshPost('#{id:edit-result}');]]></xp:this.script>
</xp:eventHandler>
</xp:radio>
<!-- other radio buttons -->
</xp:div>
<!-- other page compenents -->
<xp:panel id="actionAlert">
<!-- panel content and appropriate rendered value -->
</xp:panel>
This was attempting to do a chained partial refresh on the radio button container so that the EL would evaluate and apply/remove the 'active' style based on the document datasource ('item') value. I have also tried using dojo.addClass, dojo.removeClass, XSP.partialRefreshGet and other options. I don't mind what the solution is as long as it's efficient and works. I'd prefer not to move the actionAlert panel to within the same container as the radio buttons and I can't do a full page refresh because there are other fields which will lose their values.
Some notes:
I'm not using a RadioGroup control because it outputs a table and I haven't got around to writing my own renderer for it yet. Single Radio button controls work fine for what I need them to do.
I originally tried using the full Bootstrap solution of using "data-toggle='buttons'" (source) which sorts out applying the "active" style fine but then, inevitably, prevents the partial refresh from working.
the radio button styles are clearly not Bootstrap standard
Any assistance pointers or, preferably, working solutions would be appreciated.
You need to aim your partial refresh at the div containing all your radio buttons. Give it an id, so you can address it.
Partial refresh, as the name implies, refreshes one element and its content only. So you target the element that covers all of the items you need to recompute.
Stepping away from the problem, a couple of beers and an episode of iZombie later, I realized what I was doing wrong and sorted it out. So, for posterity, here is the simple solution that I swear I tried earlier but clearly works now:
<xp:div styleClass="btn-group item-result" id="edit-result" loaded="${Question.open}">
<xp:radio text="${lbl.kwPass1}" id="itemPass" value="#{item.ItemResult}"
styleClass="btn btn-pass" groupName="itemResult" selectedValue="1">
<xp:eventHandler event="onchange" submit="true" refreshMode="partial" refreshId="actionAlert">
<xp:this.script><![CDATA[dojo.query('.item-result > .btn').removeClass('active');
dojo.query('.btn-pass').addClass('active');]]></xp:this.script>
</xp:eventHandler>
</xp:radio>
<!-- et cetera -->
The many places I was going wrong:
In my code in the question, I was calling XSP.partialRefreshPost in the CSJS script of the radio button when it should have been in the onComplete of the eventHandler. It has to be chained to another partial refresh so that it runs after it, not at the same time. I did end up getting this right - but overlooked something I'll come to in point 3.
In my original attempt to use Dojo, my first mistake was to try and target the ID of the radio button, something like:
dojo.addClass(dojo.byId('#{id:radio2}'),'active');
This actually works as expected, so long as you remember that the ID of the radio button on the XPage refers to the actual radio button control and not the label wrapping; and the label is what I wanted to style. So the class "active" was being actually being added, just not to the element I thought it was. I should have spotted this in my browser code inspector except for the third thing I got wrong:
Ironically, I sorted out the first issue, remembering to put the XSP.partialRefreshPost into the onComplete - and then didn't remove it when trying to run the Dojo.addClass(). So I didn't notice the mistake with the addClass targeting the wrong element because after it ran, the partial refresh updated the container and removed the class I had just added which made me think that nothing was working.
So now I have some neatly styled radio buttons that don't look like radio buttons and it's all managed client side without any unnecessary partial refresh trips to the server barring the one where I actually need to look stuff up from the server. And the vital lesson is - sometimes you just need to step away from a problem and come back to it with fresh eyes later on.

How to automate to click a button which has no ID

<div class="add" data-icon="'" ng-show="!editMode" ng-click="btnAdd()"> Add an Honor or Award </div>
Above is the html code for the button i am trying to click (Add an Honor or Award), but this button doesn't have an unique ID, and keeps on changing the xpath as the user adds multiple data.
Use css
[class='add'][ng-click='btnAdd()']
xpath is also another option
//div[contains(.,'Add an Honor or Award')]
Or,
//div[#class='add']

Win8 / WinJS Pop Up Control with List View

In a Win 8 / WinJS / StoreApp - What is the recommended way to make a modal dialog that has a listview where users can select items?
For example, say I have a page with a to do list (listview). There is an app bar with a button that should open some kind of dialog from which the user can select items from previous days displayed in a listview.
I looked at the MessageDialog, but that doesn't seem to let you have a listview (or any content) inside the MessageDialog.
The other option seems to be the Flyout Control, but I haven't found a way to make it modal. Any other options?
What I would like is something like the Bing Finance application when you add a security to the watchlist. That control seems to be a MessageDialog where you can have other controls nested inside.
Thanks for any help!
If your app cannot continue without the user input then a modal dialog is appropriate. It's often times better, however, to design your user input such that the input is not absolutely required. This allows you to give the user the ability to "light dismiss" the dialog (touch anywhere outside it to make it go away).
I highly suggest the latter. In classic user input scenarios, the user was asked for a bunch of stuff at once and they felt locked in until they got it all just right. In a more modern scenario, a user is allowed to create a new widget in one touch. The widget is created with a number of defaults and the user can then go fill in the important data. Obviously the widget is not ready for "submission" (whatever that might mean in your app) until all of the required data is on it, but a user feels better being able to drop out of input mode to do some more research or whatever it might take.
So, I suggest you use a flyout for the interaction you've mentioned. If the user clicks to fly it out and then touches outside, it just disappears. If you must make it modal for some reason, then I suggest creating your own custom MessageDialog. That would really just be a matter of creating a full screen grid with three rows. The top and bottom rows would be black with partial opacity and the middle row would be your dialog. The black rows would effectively dim the background and indicate to the user that this is modal and they must respond with user input and/or a command button to dismiss it.
Hope that helps.
You can find me online at codefoster.com
Have a look at free app codeSHOW for learning Windows 8 development
I personally haven't felt very comfortable with the inline data collection flyouts. I have decided to build my own modal controls with my own grid structure layout and design.
One thing to note is if you go the custom route you will want to use data-win-options to set the placement of your modal otherwise you will get some odd keyboard behaviors with the flyout keyboard.
As a UX designer, by trade I'm carefully evaluating each of the controls and determining what works best in each scenario. Like Jeremy said above (love the show). I started by identifying how much information I intend to collect and does collecting this information on another screen interrupt my flow. So a "locked" modal which can be dismissed from a button or taping outside the modal appears to be the best approach.
<style>
.customModal
width:500px
height:375px;
display: -ms-grid;
-ms-grid-columns: 100px 1fr 100px;
-ms-grid-rows: 100px 1fr 100px;
}
.CustomModalGridTitle {
-ms-grid-column: 1;
-ms-grid-row: 1;
-ms-grid-column-span: 3;
-ms-grid-row-span: 1;
z-index: 1;
opacity: 1;
}
.CustomModalGridContent {
-ms-grid-column: 1;
-ms-grid-row: 2;
-ms-grid-column-span: 3;
-ms-grid-row-span: 1;
z-index: 1;
opacity: 1;
}
etc.....
</style>
<div class="customModal" id="customModal" data-win-control="WinJS.UI.Flyout" data-win-options="{ placement : bottom;}" >
<div class=customModalGrid>
<div class="CustomModalGridTitle"></div>
<div class="CustomModalGridContent"></div>
<div class="CustomModalGridButtons"></div>
</div>
</div>
Then I would use the grid layout tool on MS to help you construct your display grid and make it a bit more reusable: http://ie.microsoft.com/testdrive/Graphics/hands-on-css3/hands-on_grid.htm
That's the approach I have taken:). Y ou will of course need to setup your event listeners in your js to fire the customModal. Somewhere in your ready in yourpage.js
// Show the flyout
function showFormatTextFlyout() {
var myCustomModal = document.getElementById("formatTextButton");
document.getElementById("#customModal").winControl.show(myCustomModal);
}
// You may want the
If you have an outer div you can set it to 100% width and essentially mimic the Dialog control for user authentication.

Center inline-blocks with dynamic width in CSS

So.. I have a dynamic width page. Below, the wrapper div centers the divs inside of it. However, each div has a style of:
display:inline-block;
width:400px; /* static */
This makes the inside divs, side by side. But that means that there is some whitespace left over depending on the width of the browser and how many divs can go side by side without breaking to the next line.
To get an idea of what I am going for, open up your Google Chrome New Tab page and drag your browser window to make it smaller. You will see that when you go too far, some of the chrome apps bump to the next line BUT it still stays centered.
In my case, they bump to the next line and become not centered.
This is what my code looks like:
<div class="wrapper">
<div class="iB"></div>
<div class="iB"></div>
<div class="iB"></div>
<div class="iB"></div>
<div class="iB"></div>
<div class="iB"></div>
</div>
I want the inside divs to be side by side unless there is not enough room in which case the end one will bump to the next line down, ALL while staying centered in the parent div.
Thanks for any help.
If I understood you correctly adding text-align: center to your .wrapper styles should give the desired effect. See this fiddle for an example. Resize the result panel to watch the reordering of the boxes.
Like Akaishen already mentioned inline-blocks flow like text. That's why you can control their alignment with text-align. However if you want very fine control over your layout you might run into problems using inline-blocks. Since they flow like text whitespace between them is not ignored for instance. And unfortunately you can't really determine the absolute width of a space across browsers and OSs. The gaps between blocks in my example are caused by this.
As you are using the display: inline-block the <div> tags are essentially inline elements and can be styled as such. text-align: center would center each element. At this point, you need a container / wrapper to define the maximum and minimum widths.
There could be a better way to achieve what you are looking for, and this is not exactly like how the Chrome windows work, though it's a start: fiddle