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 01-13-2014, 11:48 AM
fccreations:2458016@deleted's Avatar
fccreations:2458016@deleted is offline
Junior Member
 
Join Date: Sep 2013
Posts: 5
Default

Changing Price to Sold on products page


I found a post back in 2010 where this question was asked and on 20/09/10 Qetzal replied, part of that post is below

"2. So here are the possible ways to mark the sold products on the categories pages:

- change a thumbnail completely
- add a special additional "Sold" image
- add some text to the product name or price
- replace the price with the "Sold" text"


That person was after a more automatic solution ie as soon as item sold the price disappears and replaced by "sold" which would be ideal but I don't think from the thread this has been done, it was put on "roadmap"? therefore can you advise how I do options 3 and 4 above. I have attached a file to show what I mean.

I have already added code as per one of your other forum posts, so when you select that item and it goes to individual product page it shows "Sold" instead of Out of Stock. However it would be really useful to show "Sold" on the product list screen as these items are unique, so we only generally have one but we want to show what we have produced.

Appreciate your help.
Attached Files
File Type: pdf Product showing Sold instead of Price £.pdf (517.0 KB, 112 views)
  #2  
Old 01-14-2014, 09:33 AM
smoothsailingco.com's Avatar
smoothsailingco.com smoothsailingco.com is offline
 
Join Date: Dec 2011
Location: CA / FL
Posts: 345
Default

I think this could be done with the Javascript and Product APIs.

http://kb.ecwid.com/w/page/41188517/JavaScript%20API
http://kb.ecwid.com/w/page/25285101/Product%20API

What you could do is when a category loads in the product browser you would get information about the products from the Product API. As it went through each product it could update the text if the product was out of stock and change the text to sold out.

Here's a quick test I put together: http://www.stevenkopacz.com/test/ecw...=0&sort=normal

A down side is that there's a delay in when it changes the text from the price to SOLD OUT.

-------
To DEVS: Something I noticed is that you need to put a half second pause before you can alter the product price and text. Without that 500ms pause the text is reverted to its original state.
  #3  
Old 01-14-2014, 06:54 PM
fccreations:2458016@deleted's Avatar
fccreations:2458016@deleted fccreations:2458016@deleted is offline
Junior Member
 
Join Date: Sep 2013
Posts: 5
Default

Thank you so much for the response it looks exactly what I need.

However I am new to Ecwid and API's so implementing this could be a challenge for me without some further guidance.

In your Apparel page I have found script that starts

function processSoldOut(page) { .....................

Is it as simple as pasting that section into my site, if so do I need to use the secret keys referred to in the API tab, or using the Dashboard.

Sorry if I have got this totally wrong but as I said I am new to this!
  #4  
Old 01-14-2014, 11:46 PM
smoothsailingco.com's Avatar
smoothsailingco.com smoothsailingco.com is offline
 
Join Date: Dec 2011
Location: CA / FL
Posts: 345
Default

Paste this below your ecwid code. The ecwid code looks like:
Code:
<script type="text/javascript" src="http://app.ecwid.com/script.js?1003" charset="utf-8"></script>
So you'll want this below that:
Code:
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js" charset="utf-8"></script>
<script>
        Ecwid.OnPageLoaded.add(function(page) {
            if ( page.type == "CATEGORY" ) {
                setTimeout(function(){
                    processSoldOut(page);
                },500);
            }
        });
        
        function processSoldOut(page) {
            $.getJSON("http://app.ecwid.com/api/v1/1003/category?callback=?", {id : page.categoryId}).done( function( category ) {
                var products = category.products;
                $.each( products, function( index, product ) {
                    if (product.quantity == 0) {
                        var selector = "a[href$='id=" + product.id + "']";
                        $("html#ecwid_html body#ecwid_body .ecwid-productBrowser-productNameLink").find(selector)
                            .closest(".ecwid-productBrowser-productsGrid-productBottomFragment")
                            .find("span.ecwid-productBrowser-price-value").text("SOLD OUT");
                    }
                });
            });
        }  
</script>
You won't need the secret key since were just reading from the api but you will need to change the store ID. Change 1003 in http://app.ecwid.com/api/v1/1003/category?callback=? to yours.
The Following 3 Users Say Thank You to smoothsailingco.com For This Useful Post:
fccreations:2458016@deleted (01-15-2014), Lanna (01-15-2014), Maya (01-15-2014)
  #5  
Old 01-16-2014, 12:44 AM
fccreations:2458016@deleted's Avatar
fccreations:2458016@deleted fccreations:2458016@deleted is offline
Junior Member
 
Join Date: Sep 2013
Posts: 5
Default

Thank you for the script which I altered to my store id and added after the Ecwid script you showed.

However when I loaded it the product page locked up in the editor, by the way Ecwid is used with a BaseKit website.

I had to contact BaseKit to unlock it which they have done removing that script.

I added some other script to change out of stock to Sold earlier this week and that worked fine and yours worked on your demo so not sure of the reason.
  #6  
Old 01-16-2014, 01:12 AM
smoothsailingco.com's Avatar
smoothsailingco.com smoothsailingco.com is offline
 
Join Date: Dec 2011
Location: CA / FL
Posts: 345
Default

Weird. Did it only lock up on Product pages? It shouldn't even fire on those. Could you link me to your website?
  #7  
Old 01-17-2014, 01:30 PM
fccreations:2458016@deleted's Avatar
fccreations:2458016@deleted fccreations:2458016@deleted is offline
Junior Member
 
Join Date: Sep 2013
Posts: 5
Default

Hi
Have an update BaseKit suggested pasting the script rather than embedding which I had apparently done, this time it saved but when I went to preview the screen it wouldn't change from editor mode.

I have asked BaseKit and they are being very helpful but say they don't provide support for external script or widgets.

Here is our link. The page I want to have "Sold" on instead of price is the next one you go to after choosing "Store". For example if you select Midi you will see products with prices, if you select "Side Cabinet" the next page shows its "Sold" which is what I have altered already with some script.

www.fccreations.co.uk

Just want to check should I be pasting this into the BaseKit editor or the Ecwid site. I pasted the other code I had into the Basekit
  #8  
Old 01-17-2014, 11:49 PM
smoothsailingco.com's Avatar
smoothsailingco.com smoothsailingco.com is offline
 
Join Date: Dec 2011
Location: CA / FL
Posts: 345
Default

Javascript code should be pasted in BaseKit.

It's only locking up the editor? Are you able to save and see if the script works in the store?
  #9  
Old 01-17-2014, 11:52 PM
smoothsailingco.com's Avatar
smoothsailingco.com smoothsailingco.com is offline
 
Join Date: Dec 2011
Location: CA / FL
Posts: 345
Default

It should be pasted below:
Code:
<script type="text/javascript" src="http://app.ecwid.com/script.js?2458016" charset="utf-8"></script><script type="text/javascript"> xProductBrowser("categoriesPerRow=3","views=grid(3,3) list(10) table(20)","categoryView=grid","searchView=list","style=","id=my-store-2458016");</script>
In the file that displays: http://www.fccreations.co.uk/store
  #10  
Old 01-18-2014, 12:00 AM
smoothsailingco.com's Avatar
smoothsailingco.com smoothsailingco.com is offline
 
Join Date: Dec 2011
Location: CA / FL
Posts: 345
Default

It looks like you have jQuery already on your site. Also I tried testing the code I gave you and it didn't work

Here's updated code that does:
Code:
<script>
        Ecwid.OnPageLoaded.add(function(page) {
            if ( page.type == "CATEGORY" ) {
                setTimeout(function(){
                    processSoldOut(page);
                },500);
            }
        });
        
        function processSoldOut(page) {
            $.getJSON("http://app.ecwid.com/api/v1/2458016/category?callback=?", {id : page.categoryId}).done( function( category ) {
                var products = category.products;
                $.each( products, function( index, product ) {
                    if (product.quantity == 0) {
                        var selector = "a[href$='id=" + product.id + "']";
                        $(".ecwid-productBrowser-productNameLink").find(selector)
                            .closest(".ecwid-productBrowser-productsGrid-productBottomFragment")
                            .find("span.ecwid-productBrowser-price-value").text("SOLD OUT");
                    }
                });
            });
        } 
</script>
It could be possible that having multiple references to jQuery may have caused the problem. If you only use the code above does it still lock up?

Last edited by smoothsailingco.com; 01-18-2014 at 12:02 AM.
The Following User Says Thank You to smoothsailingco.com For This Useful Post:
Maya (01-20-2014)
 
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

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 09:29 AM.
Powered by vBulletin® Version 3.8.11. Copyright ©2000 - 2021, Jelsoft Enterprises Ltd.