Element Cart Modification

Questions and answers about ShopSite Custom Templates

Element Cart Modification

Postby tmlogo » Tue May 17, 2022 4:19 pm

I have tweaked the Element Cart template, but still would like to add a price per product as we deal with quantity purchases. I see that it uses [-- SC_CART_V2 --] which does not allow for the item price just the final total. I like the layout better than [-- SC_CART --] Is there a workaround for this as I like the rest of the layout.

Thanks in advance.
tmlogo
 
Posts: 110
Joined: Tue Jun 17, 2008 3:00 pm

Re: Element Cart Modification

Postby ShopSite Lauren » Thu May 19, 2022 7:11 am

You could add the following javascript on your shopping cart page either in the template or in the "text at the bottom of the shopping cart screen" field found under Commerce > Order System > Shopping Cart.

Code: Select all
<script type="text/javascript">
for (i = 0; i < number_products; i++) {
 document.getElementsByClassName("cart-product-quantity")[i].innerHTML = "Each - $" + ss_price[i] + "<br>" + document.getElementsByClassName("cart-product-quantity")[i].innerHTML;
}
</script>
- ShopSite Lauren
Contact me for help with any of your
custom ShopSite template questions.
ShopSite Lauren
 
Posts: 889
Joined: Fri Aug 11, 2006 1:35 pm
Location: Orem, UT

Re: Element Cart Modification

Postby tmlogo » Thu May 19, 2022 2:29 pm

Thank you so much! That's just what I needed.

I do have one more question, is there anyway possible for people to upload a file (logo) as an option in their shopping cart and have it associated with their order?
tmlogo
 
Posts: 110
Joined: Tue Jun 17, 2008 3:00 pm

Re: Element Cart Modification

Postby ShopSite Lauren » Wed May 25, 2022 2:34 pm

No, that isn't a feature in ShopSite. You could add some javascript on the thank you screen to detect products that need a logo, then display a link to another page where you have an upload feature outside of ShopSite (ask your hosting provider if this is something they could set up on your domain...some hosts don't allow 'just anyone' to upload for security reasons). Depending on how your external upload feature works, you may be able to name the upload with the customer's order number or something like that (order number could be passed pretty easily to the upload page, if the upload page would have anywhere to put that information).

That probably all sounds like a lot. First I would suggest contacting your hosting provider and see if there is a way they could set up an upload page on your domain where visitors could upload files. Then if you DM me, I can help you from there.
- ShopSite Lauren
Contact me for help with any of your
custom ShopSite template questions.
ShopSite Lauren
 
Posts: 889
Joined: Fri Aug 11, 2006 1:35 pm
Location: Orem, UT

Re: Element Cart Modification

Postby tmlogo » Fri Jun 10, 2022 12:55 pm

Thank you Lauren. It appears that the upload won't be possible with our host.

I did have one more template question. The pages automatically generate "Page:" even if the number of products for that page fills only one page. Is there a way to let the template know not to put "Page:" unless there are enough products for multiple pages?
tmlogo
 
Posts: 110
Joined: Tue Jun 17, 2008 3:00 pm

Re: Element Cart Modification

Postby ShopSite Lauren » Tue Jun 14, 2022 3:44 pm

You could add an IF statement around the previous/next links... so this...

[-- IF PAGE.ProductsPerPage NE 0 --]<div id="top-pagination" class="pagination d-flex flex-wrap justify-content-center align-items-center mb-4"><span class="pr-2 font-weight-bold">[-- STORE.454 --]</span> [-- PrevNext NoCenter --]</div>[-- END_IF --]

would become this...

[-- IF PAGE.ProductsPerPage NE 0 --][-- IF PAGE.ProductsPerPage LT PAGE.NumProducts --]<div id="top-pagination" class="pagination d-flex flex-wrap justify-content-center align-items-center mb-4"><span class="pr-2 font-weight-bold">[-- STORE.454 --]</span> [-- PrevNext NoCenter --]</div>[-- END_IF --][-- END_IF --]


I added the [-- IF PAGE.ProductsPerPage LT PAGE.NumProducts --][-- END_IF --] statement. This says IF the number of products per page is Less Than (LT) the number of products that are assigned to the page, then proceed with the code for the pagination.
- ShopSite Lauren
Contact me for help with any of your
custom ShopSite template questions.
ShopSite Lauren
 
Posts: 889
Joined: Fri Aug 11, 2006 1:35 pm
Location: Orem, UT


Return to Custom Template Questions

Who is online

Users browsing this forum: No registered users and 8 guests