View Single Post
  #11  
Old 02-18-2015, 11:32 AM
enot's Avatar
enot enot is offline
 
Join Date: Oct 2014
Posts: 499
Default

Quote:
Originally Posted by Th sp View Post
Hi Stephan,

Thank you very much!
I appreciate the help.

I did try your code. It does change the Qty to 5, but unfortunately it does so for ALL products.
Have not been able to fix it yet.

Any ideas?

Thanks!
Hi!

Sorry, I've indeed missed a couple of parts while editing, that's why the second condition was ignored, and the script changed quantity for all product pages.

To make this work, id's should be wrapped in brackets, and "productId" should be replaced with "page.productID".

Here's the code that should do the trick (This and my previous messages were edited, to prevent anyone else from getting the wrong script).

Code:
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js"></script>
<script>
if (typeof(Ecwid) == 'object') {
Ecwid.OnPageLoaded.add(function(page) {
var pids = [3432333, 3432332, 4543212];
if ('PRODUCT' == page.type)
for(var i=0; i<pids.length; i++) {
if (pids[i]==page.productId)
{
$('input.ecwid-productBrowser-details-qtyTextField').val('5');
}
}
});
}
</script>

Hope this helps.

Last edited by enot; 02-18-2015 at 07:31 PM. Reason: Corrected the code, left a note