The information in this thread might be outdated
If the solution did not help, please, check our Help Portal or contact Ecwid Team.
 
 
Thread Tools Display Modes
  #1  
Old 09-10-2015, 01:43 AM
undefined12116's Avatar
undefined12116 is offline
 
Join Date: Aug 2015
Posts: 18
Default

Help needed: Java code for a second product item counter


Hi,

I'm designing a very simple and small ecommerce site in Adobe Muse for a friend of mine who has a copy shop in Barcelona, Spain. (I don't know anything about coding.) The products he offers are basically print services. Two examples: B&W printing and Color printing. Each product has a price per printed page. Let's say the price is $ 0.05. The buyer should choose the product and then, among other options and price modifiers, input two numbers:

1) The number of pages he/she will send the copy shop to print (through an upload), and
2) The number of copies the shop should print of each page.

So... If the price is $ 0.05, he/she uploads 10 pages and wants 20 copies of each page, the system should make the following calculation:

$ 0.05 x 10 pages x 20 copies = $ 10

And that is the price that should be reflected in the cart.

But the system only offers one counter: for number of items. That one counter could be used for 'number of copies'. But I still would need the first counter, for 'number of pages'.

So my question is... Is there any code available to add this function and could someone explain me how to add it to Adobe Muse?

Thanks a lot in advance,

Daniel
  #2  
Old 09-21-2015, 09:24 AM
river's Avatar
river river is offline
Ecwid Team
 
Join Date: Feb 2015
Posts: 452
Default

Quote:
Originally Posted by undefined12116 View Post
Hi,

I'm designing a very simple and small ecommerce site in Adobe Muse for a friend of mine who has a copy shop in Barcelona, Spain. (I don't know anything about coding.) The products he offers are basically print services. Two examples: B&W printing and Color printing. Each product has a price per printed page. Let's say the price is $ 0.05. The buyer should choose the product and then, among other options and price modifiers, input two numbers:

1) The number of pages he/she will send the copy shop to print (through an upload), and
2) The number of copies the shop should print of each page.

So... If the price is $ 0.05, he/she uploads 10 pages and wants 20 copies of each page, the system should make the following calculation:

$ 0.05 x 10 pages x 20 copies = $ 10

And that is the price that should be reflected in the cart.

But the system only offers one counter: for number of items. That one counter could be used for 'number of copies'. But I still would need the first counter, for 'number of pages'.

So my question is... Is there any code available to add this function and could someone explain me how to add it to Adobe Muse?

Thanks a lot in advance,

Daniel
Hi,

I'm sorry for the delay with response.

You are right about the quantity field - it may be used to define the number of copies in this case.

By the way, there's a way to change the "Qty" label in your store to something like "Copies:". In this case you need to add a certain script right before the Ecwid container in Adobe Muse (you may see the detailed instruction here):

Code:
<script>
ecwidMessages = {
"OrderBox.qty":"Copies",
"OrderComponent.gty":"Copies\:",
"ProductDetails.invalid_qty":"Invalid quantity entered. Reenter it please.",
"ProductDetails.qty":"Copies",
"ShoppingCartView.qty":"Copies"
}
</script>
Now the issue is in defining the number of pages.

Well, there's no particular ready script for that and there's some custom programming needed to achieve that like you want it to be. You would need to use Ecwid API for making it happen and apparently hiring a programmer would also be a good idea. You may address to Qualiteam, for example: sales@qtmsoft.com They often make custom solutions for Ecwid and will certainly be able to help you out.

However, there's a possible workaround with no scripting I can suggest. You may create a certain drop-down menu product option in your store and add, well, rather many selections for it to set the amount of pages. For example, create 10 or 100 selections in it - one for each page your customer wants to print. Each selection should add a certain sum to the product.

Please see the example screenshot:



As you see, the first selection in the option is for 1 page and it adds $0.5 to the product price. The second (two pages) adds $0.5 + $0.5 = $1, three pages is $1.5 etc.

Of course in this case customers will not be able to set the amount of pages by simply writing the number of them into a field, but they will be able to choose among the given options from 1 to 100 or as many pages as the number of selections you create. It might take some time to create as many selections as you need, for sure, but otherwise it's only possible to achieve the same with custom scripting.

Hope this helps. If there's anything else I can help you with, please don't hesitate to ask!
__________________
Roman I.
Ecwid Customer Care Team

More tips and hints on Ecwid use in our Help Center

⬇ Please click Thanks if my reply helped you.
  #3  
Old 09-24-2015, 09:08 PM
undefined12116's Avatar
undefined12116 undefined12116 is offline
 
Join Date: Aug 2015
Posts: 18
Default

Hi Roman,

Thanks for your kind and lengthy reply.

Disgracefully, the drop-down menu you suggest will not work, because the customer can choose anything between 1 and, say, 500 pages. It would be crazy to offer a drop-down with 500+ options.

I will definitely contact the people you mention. Hope they are not too expensive.

Just want to ask you something else, if you don't mind:

Will ecwid allow me to embed individual products in different pages on the Muse website (wherever I want to place them) in such a way that they will still work with only one cart? I don't want to embed the widget for the whole store in one place. I want to embed individual products in different places. Will this bring any problems to the customer interacting with only one cart?

Thanks again,

Daniel
  #4  
Old 09-28-2015, 04:24 PM
river's Avatar
river river is offline
Ecwid Team
 
Join Date: Feb 2015
Posts: 452
Default

Quote:
Originally Posted by undefined12116 View Post
Hi Roman,

Thanks for your kind and lengthy reply.

Disgracefully, the drop-down menu you suggest will not work, because the customer can choose anything between 1 and, say, 500 pages. It would be crazy to offer a drop-down with 500+ options.

I will definitely contact the people you mention. Hope they are not too expensive.

Just want to ask you something else, if you don't mind:

Will ecwid allow me to embed individual products in different pages on the Muse website (wherever I want to place them) in such a way that they will still work with only one cart? I don't want to embed the widget for the whole store in one place. I want to embed individual products in different places. Will this bring any problems to the customer interacting with only one cart?

Thanks again,

Daniel
Hello,

Thank you for your reply!

There's definitely a way to add single products to a Muse website as well using one of 2 available plugins for Adobe Muse: J-26 or MuseThemes. The Single Product widgets are included in these plugins along with Product Browser, Search etc.

You may find more information about the plugins here: https://help.ecwid.com/customer/en/p...004-adobe-muse

Don't hesitate to ask if any more questions appear!
__________________
Roman I.
Ecwid Customer Care Team

More tips and hints on Ecwid use in our Help Center

⬇ Please click Thanks if my reply helped you.
  #5  
Old 09-30-2015, 10:33 AM
undefined12116's Avatar
undefined12116 undefined12116 is offline
 
Join Date: Aug 2015
Posts: 18
Default

Hi Brandon,

I contacted qtmsoft as per your advice. But they say that the ecwid API does not allow for the tweak I'm after. I'm attaching their asnwer for your perusal. I would very much appreciate it if you could check what they are saying and confirm or find a workaround. I know the requirements of a copy shop are different than most other businesses, but it would be a pitty to not use ecwid because of this problem.

Thanks a lot in advance, Daniel


......................

Dear Daniel,

We do not see the possibility to modify Ecwid store in order to add extra field which will be multiplied by all selected options and base price. Ecwid does not have the API methods for that.

If you have more than 1 price modifier, then the number of pages as standard option won't work for you too, unfortunately.

However, if Ecwid guys suggested you some workaround, please send us the description and we will investigate it. Thank you.

Best regards,
Alena Yastrebkova
Project manager
  #6  
Old 10-01-2015, 11:37 AM
river's Avatar
river river is offline
Ecwid Team
 
Join Date: Feb 2015
Posts: 452
Default

Quote:
Originally Posted by undefined12116 View Post
Hi Brandon,

I contacted qtmsoft as per your advice. But they say that the ecwid API does not allow for the tweak I'm after. I'm attaching their asnwer for your perusal. I would very much appreciate it if you could check what they are saying and confirm or find a workaround. I know the requirements of a copy shop are different than most other businesses, but it would be a pitty to not use ecwid because of this problem.

Thanks a lot in advance, Daniel


......................

Dear Daniel,

We do not see the possibility to modify Ecwid store in order to add extra field which will be multiplied by all selected options and base price. Ecwid does not have the API methods for that.

If you have more than 1 price modifier, then the number of pages as standard option won't work for you too, unfortunately.

However, if Ecwid guys suggested you some workaround, please send us the description and we will investigate it. Thank you.

Best regards,
Alena Yastrebkova
Project manager
Hello,

That is rather unfortunate that they were not able to help you out.

I have investigated the issue on my side as well and tried to see why it's impossible. However, I tried to investigate it by means of JavaScript using Ecwid JavaScript API. I got a little carried away in process and was able to write a workaround solution (very messy, though, since I'm not a developer, unfortunately).

It's possible to achieve the multiplied quantities by means of product options. The script uses a text field option as a method of getting another quantity.

To summarise: the script works for a certain product with one option titled "Copies". It's possible to input the product ID into a certain variable in the script, so it would be able to work for any product. It can probably also be tweaked further in order to make it work better. It's definitely not a ready solution right now, but it might at least give some hints to Qualiteam (like using options as a price multiplier). So you can pass it over to them.

The major issue needed a workaround here is that you need the "Upload file" option and we need to clear cart on checkout in order for the price to recalculate. It means that if the customer uploads the file from a product details page, it will get cleared on checkout and the customer will need to upload a file again.

Here's the workflow suggested by the script (I recorded a screencast here): https://monosnap.com/file/awrNGwdiwb...MOnEO363UEZRJe

In details the script does the following:

1. It hides the "Upload file" option from product details pages;

2. Changes some labels in store like "Qty" to "Pages amount in your file", "Change"
button in Cart to "Upload" etc.

3. Uses the "Copies" option as a multiplier for quantity.

4. When the customer is in Cart, the cart is cleared and the product is re-added to it with the multiplied quantity.

5. Quantity gets unchangeable in Cart.

6. The "Change" button's label is changed to "Upload" for the customer to see that they need to upload their file in Cart before proceeding to checkout.

Some other changes are needed to make the script better, of course, but still it does not seem to be a plausible solution. So, it can probably only work as a hint.

Here's the script:

Code:
<script src="https://code.jquery.com/jquery-1.10.2.js"></script>
<script>
Ecwid.OnPageLoad.add(function(page) {
  var productID = 50250492; //state your Product ID here
  jQuery('#ecwid-productoption-' + productID + '-Upload_your_file_here-container').hide(); //hides the "Upload your file" from the product details page
  if ("CART" == page.type) {
    jQuery(".ecwid-productBrowser-cart-qtyTextField").css("pointer-events" , "none"); //disables the Quantity field in Cart
    var CartQuantity = jQuery('.ecwid-productBrowser-cart-qtyTextField').val(); 
    var OptionTitle = jQuery('.ecwid-productBrowser-cart-optionsList-name').text();
    if (OptionTitle == 'Copies:') { //you may change the 'Copies:' to the name you prefer for this option
    var CopiesAmount = jQuery('.ecwid-productBrowser-cart-optionsList-value').text();
    var FinalQuantity = CartQuantity * CopiesAmount; //here we create a variable which is pulled to the quantity field on checkout
    jQuery('.ecwid-productBrowser-cart-qtyTextField').val(FinalQuantity);
    };
  };
    if ("CART" == page.type && FinalQuantity == CartQuantity * CopiesAmount) {
      Ecwid.Cart.get(function(cart) {
      Ecwid.Cart.clear(); //we need to clear the cart first in order to recalculate the price
      var Myproduct = { id: productID, quantity: FinalQuantity, }; 
      Ecwid.Cart.addProduct(Myproduct); //and add products back based on the updated multiplied quantity
    });
    };
    jQuery(".ecwid-productBrowser-details-qtyLabel").replaceWith("Pages in your document");
    
  });

$( document ).ready(function() { //change some labels
ecwidMessages = {
"AddressBookItem.change":"Upload",
"ChangeOptionsPopup.change_options":"Upload your file",
"OrderComponent.change":"Upload file",
"ShoppingCartView.agree":"I've uploaded my file!",
"ShoppingCartView.change":"Upload file"
};
});
</script>
Hope this helps at least to point you in the right direction. Please feel free to ask if any more questions appear.
__________________
Roman I.
Ecwid Customer Care Team

More tips and hints on Ecwid use in our Help Center

⬇ Please click Thanks if my reply helped you.
The Following User Says Thank You to river For This Useful Post:
undefined12116 (10-01-2015)
  #7  
Old 10-01-2015, 01:32 PM
undefined12116's Avatar
undefined12116 undefined12116 is offline
 
Join Date: Aug 2015
Posts: 18
Default

Hi Roman,

Extremely grateful for your time, patience, and efforts.

I watched the screencast and, from what I can tell (before testing it, because I still don't know how to add the code to the site), your tweak seems to solve the problem i was facing. Why do you consider it to be not a 'ready' solution? For me it is fine if the customer uploads the file(s) at the end, in the cart, instead of doing it at the beginning, in the product selection page. But what happens if the customer adds 2 or 3 products to the cart before checkout? Will the system add all this info to the final price? Will the cart requiere him to upload at least one file for each product?

Please let me know what do you believe is wrong (or problematic) in your tweak, or what do you think I shoud ask the Qualiteam to develop further.

And please let me know what do I have to do to test your script in Muse? Do I add it to the script I get for embedding each product? Do I add it somewhere else?

(An additional question: Does ecwid allow to add a info button next to each product for the customer to read further instructions upon mouse over?)

I forwarded your workaround to Qualiteam and this is what they answered (please see below). I thought it would be wise to double-check with you guys before committing to anything.

Please let me know what you think and if the developers at ecwid think there is no other/better solution.

Thanks a lot,

Daniel

.....................................

Dear Daniel,

Thank you for the update.

The suggested solution uses the one QTY field in the end. The number of copies and pages are visible only on the product page, and starting from the cart page the numbers are combined into one. Then only this QTY is visible on all other pages - checkout, email notifications, order details and etc. We do not offered such solution because we think it might confuse the customers if they see only multiplied qty, don't you think so? Also it does not update the price on the product page unlike in your example http://www.copytop.es/

But if it's OK, then we could implement some similar workaround. We would improve its logic so it works properly without clearing the cart, the changes might be made only on products pages. However the main disadvantages will be the same:
- One multiplied QTY will be visible on the cart and checkout pages, in the order details and email notifications. The minicart icon will also display multiplied qty.
- The price on the product pages won't be updated when the number of copies is changed.
- The products stock level should be unlimited so that the script work properly.

If you are interested, let me know and we will discuss the modification in more details. Thank you!

Last edited by river; 10-01-2015 at 03:42 PM.
  #8  
Old 10-01-2015, 03:53 PM
river's Avatar
river river is offline
Ecwid Team
 
Join Date: Feb 2015
Posts: 452
Default

Quote:
Originally Posted by undefined12116 View Post
Hi Roman,

Extremely grateful for your time, patience, and efforts.

I watched the screencast and, from what I can tell (before testing it, because I still don't know how to add the code to the site), your tweak seems to solve the problem i was facing. Why do you consider it to be not a 'ready' solution? For me it is fine if the customer uploads the file(s) at the end, in the cart, instead of doing it at the beginning, in the product selection page. But what happens if the customer adds 2 or 3 products to the cart before checkout? Will the system add all this info to the final price? Will the cart requiere him to upload at least one file for each product?

Please let me know what do you believe is wrong (or problematic) in your tweak, or what do you think I shoud ask the Qualiteam to develop further.

And please let me know what do I have to do to test your script in Muse? Do I add it to the script I get for embedding each product? Do I add it somewhere else?

(An additional question: Does ecwid allow to add a info button next to each product for the customer to read further instructions upon mouse over?)

I forwarded your workaround to Qualiteam and this is what they answered (please see below). I thought it would be wise to double-check with you guys before committing to anything.

Please let me know what you think and if the developers at ecwid think there is no other/better solution.

Thanks a lot,

Daniel

.....................................

Dear Daniel,

Thank you for the update.

The suggested solution uses the one QTY field in the end. The number of copies and pages are visible only on the product page, and starting from the cart page the numbers are combined into one. Then only this QTY is visible on all other pages - checkout, email notifications, order details and etc. We do not offered such solution because we think it might confuse the customers if they see only multiplied qty, don't you think so? Also it does not update the price on the product page unlike in your example http://www.copytop.es/

But if it's OK, then we could implement some similar workaround. We would improve its logic so it works properly without clearing the cart, the changes might be made only on products pages. However the main disadvantages will be the same:
- One multiplied QTY will be visible on the cart and checkout pages, in the order details and email notifications. The minicart icon will also display multiplied qty.
- The price on the product pages won't be updated when the number of copies is changed.
- The products stock level should be unlimited so that the script work properly.

If you are interested, let me know and we will discuss the modification in more details. Thank you!
Hello Daniel,

The disadvantages described by Qualiteam are basically the same as those I had in mind. This is why the script can not be called a ready solution in the first place.

However, their solution is a lot better than the script if they can implement it as described. It should be much easier for the customer without clearing cart and uploading the files on checkout.

Also, please note that there might be a workaround for this issue as well:

Quote:
- One multiplied QTY will be visible on the cart and checkout pages, in the order details and email notifications. The minicart icon will also display multiplied qty.
Labels in Ecwid can be changed, so instead of "Qty" which will be multiplied, you can change it to something like: "Pages total" or "Total qty of pages to print" or whatnot. So, it seems like this one is partly solvable. You can consult with Qualiteam on that matter as well.

Hope you will be able to achieve the desired result! Don't hesitate to ask if there's anything else I can help you with.
__________________
Roman I.
Ecwid Customer Care Team

More tips and hints on Ecwid use in our Help Center

⬇ Please click Thanks if my reply helped you.
The Following User Says Thank You to river For This Useful Post:
undefined12116 (10-23-2015)
 
The information in this thread might be outdated
If the solution did not help, please, check our Help Portal or contact Ecwid Team.

Tags
adobe muse, api, counter

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 02:25 PM.
Powered by vBulletin® Version 3.8.11. Copyright ©2000 - 2021, Jelsoft Enterprises Ltd.