Page 1 of 2 12 LastLast
Results 1 to 10 of 20
  1. #1
    Join Date
    Jan 2010
    Posts
    10
    Plugin Contributions
    0

    Default Display how many times a product has been purchased?

    I now this information is available in the admin section in the Products Purchased Report, but I do not know how to display it in the store. I would like to display how many times a product has been purchased so the customer can see how many have been sold. Any thoughts on how to do this?

  2. #2
    Join Date
    Sep 2003
    Location
    Ohio
    Posts
    64,697
    Plugin Contributions
    6

    Default Re: Display how many times a product has been purchased?

    In the products table the field products_ordered holds the number of Products Ordered since the last reset ...

    There is a function that could be used for this in the
    Code:
    functions_lookups.php file:
     * Return any field from products or products_description table
     * Example: zen_products_lookup('3', 'products_date_added');
     */
      function zen_products_lookup($product_id, $what_field = 'products_name', $language = '') {
    Just send the products_id and the field that you want to obtain the value ...
    Linda McGrath
    If you have to think ... you haven't been zenned ...

    Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!

    Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today: v1.5.1]
    Officially PayPal-Certified! Just click here

    Try our Zen Cart Recommended Services - Hosting, Payment and more ...

  3. #3
    Join Date
    Jan 2010
    Posts
    10
    Plugin Contributions
    0

    Default Re: Display how many times a product has been purchased?

    Thanks Ajeh!
    I hate to trouble you further, but I know just enough about php to be dangerous. Could you give me an idea of how to code that into the product listing? I would probably want to see it near the product price or "add to cart" button. I know how to do the css formatting if the php is coded correctly.

  4. #4
    Join Date
    Sep 2003
    Location
    Ohio
    Posts
    64,697
    Plugin Contributions
    6

    Default Re: Display how many times a product has been purchased?

    You could customize the Product Listing to show the number of products sold by copying the file:
    /includes/modules/products_listing.php

    to your templates and overrides directory and change the code:
    Code:
            $lc_text .= '<br />' . (zen_get_show_product_switch($listing->fields['products_id'], 'ALWAYS_FREE_SHIPPING_IMAGE_SWITCH') ? (zen_get_product_is_always_free_shipping($listing->fields['products_id']) ? TEXT_PRODUCT_FREE_SHIPPING_ICON . '<br />' : '') : '');
    to read:
    Code:
            $lc_text .= '<br />' . (zen_get_show_product_switch($listing->fields['products_id'], 'ALWAYS_FREE_SHIPPING_IMAGE_SWITCH') ? (zen_get_product_is_always_free_shipping($listing->fields['products_id']) ? TEXT_PRODUCT_FREE_SHIPPING_ICON . '<br />' : '') : '');
    
            $lc_text .= '<br />' . 'Sold: ' . zen_products_lookup($listing->fields['products_id'], 'products_ordered');
    Linda McGrath
    If you have to think ... you haven't been zenned ...

    Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!

    Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today: v1.5.1]
    Officially PayPal-Certified! Just click here

    Try our Zen Cart Recommended Services - Hosting, Payment and more ...

  5. #5
    Join Date
    Jan 2010
    Posts
    10
    Plugin Contributions
    0

    Default Re: Display how many times a product has been purchased?

    Thanks! I have tried your suggestion, and it seems logical, but nothing displays. My client has also requested the same thing appear in the Featured Product listings on the main index page. I have tried that same code there, but nothing displays there either. Any thoughts?

  6. #6
    Join Date
    Sep 2003
    Location
    Ohio
    Posts
    64,697
    Plugin Contributions
    6

    Default Re: Display how many times a product has been purchased?

    Do you see the word Sold: at all?

    Make sure that you named your templates and overrides directory correctly for:
    /includes/modules/your_template_dir
    Linda McGrath
    If you have to think ... you haven't been zenned ...

    Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!

    Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today: v1.5.1]
    Officially PayPal-Certified! Just click here

    Try our Zen Cart Recommended Services - Hosting, Payment and more ...

  7. #7
    Join Date
    Jan 2010
    Posts
    10
    Plugin Contributions
    0

    Default Re: Display how many times a product has been purchased?

    I have double checked, I am placing the file in the correct directory. I also made sure I "purchased" the item, to make sure it will show that the item has sold. The sold item also shows up in the admin section where it is supposed to.

    Entering the new code into the product_listing.php, nothing at all displays in the store. When I tried placing it into the featured products file, I received the word "Sold" but no quantity appeared after it.

  8. #8
    Join Date
    Jun 2005
    Location
    Hertfordshire, UK
    Posts
    9,916
    Plugin Contributions
    3

    Default Re: Display how many times a product has been purchased?

    I could be a bit embarrassing however, to have show up in your store.

    "This product has been purchased "0" times".


    ... not a very inspirational message to give to customers.

    I would even be wary if it said

    "This product has been purchased "10" times".


    ... only 10 times? There are 6 billion people in the world? howcome only 10 ever got sold? Can't be that good.

    And sadly. if it said:

    "This product has been purchased "10,000,000" times".


    ... Wow... must be for common folk, not unique individuals like me... Can't be very special if every idiot is buying it!

    Did my post help you fix something? You can show your gratitude by buying the the dev team coffee.

  9. #9
    Join Date
    Jan 2010
    Posts
    10
    Plugin Contributions
    0

    Default Re: Display how many times a product has been purchased?

    Additional thoughts, anyone?

  10. #10
    Join Date
    Sep 2003
    Location
    Ohio
    Posts
    64,697
    Plugin Contributions
    6

    Default Re: Display how many times a product has been purchased?

    In the file:
    /includes/modules/product_listing.php

    that you copied to your directory:
    /includes/modules/your_template_dir/product_listing.php

    You should have code such as:
    Code:
            $the_button = $lc_button;
            $products_link = '<a href="' . zen_href_link(zen_get_info_page($listing->fields['products_id']), 'cPath=' . ( ($_GET['manufacturers_id'] > 0 and $_GET['filter_id']) > 0 ? zen_get_generated_category_path_rev($_GET['filter_id']) : $_GET['cPath'] > 0 ? zen_get_generated_category_path_rev($_GET['cPath']) : zen_get_generated_category_path_rev($listing->fields['master_categories_id'])) . '&products_id=' . $listing->fields['products_id']) . '">' . MORE_INFO_TEXT . '</a>';
            $lc_text .= '<br />' . zen_get_buy_now_button($listing->fields['products_id'], $the_button, $products_link) . '<br />' . zen_get_products_quantity_min_units_display($listing->fields['products_id']);
            $lc_text .= '<br />' . (zen_get_show_product_switch($listing->fields['products_id'], 'ALWAYS_FREE_SHIPPING_IMAGE_SWITCH') ? (zen_get_product_is_always_free_shipping($listing->fields['products_id']) ? TEXT_PRODUCT_FREE_SHIPPING_ICON . '<br />' : '') : '');
            $lc_text .= '<br />' . 'Sold: ' . zen_products_lookup($listing->fields['products_id'], 'products_ordered');
    
            break;
    Try adding to the file:
    Code:
            $the_button = $lc_button;
            $products_link = '<a href="' . zen_href_link(zen_get_info_page($listing->fields['products_id']), 'cPath=' . ( ($_GET['manufacturers_id'] > 0 and $_GET['filter_id']) > 0 ? zen_get_generated_category_path_rev($_GET['filter_id']) : $_GET['cPath'] > 0 ? zen_get_generated_category_path_rev($_GET['cPath']) : zen_get_generated_category_path_rev($listing->fields['master_categories_id'])) . '&products_id=' . $listing->fields['products_id']) . '">' . MORE_INFO_TEXT . '</a>';
            $lc_text .= '<br />' . zen_get_buy_now_button($listing->fields['products_id'], $the_button, $products_link) . '<br />' . zen_get_products_quantity_min_units_display($listing->fields['products_id']);
            $lc_text .= '<br />' . (zen_get_show_product_switch($listing->fields['products_id'], 'ALWAYS_FREE_SHIPPING_IMAGE_SWITCH') ? (zen_get_product_is_always_free_shipping($listing->fields['products_id']) ? TEXT_PRODUCT_FREE_SHIPPING_ICON . '<br />' : '') : '');
            $lc_text .= '<br />' . 'Sold: ' . zen_products_lookup($listing->fields['products_id'], 'products_ordered');
            
    echo 'I AM THE PRODUCTS_LISTING!' . '<br>';
             break;
    and see if you see that repeat a number of times in your Product Listing when you click on a Category of products ...
    Linda McGrath
    If you have to think ... you haven't been zenned ...

    Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!

    Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today: v1.5.1]
    Officially PayPal-Certified! Just click here

    Try our Zen Cart Recommended Services - Hosting, Payment and more ...

 

 
Page 1 of 2 12 LastLast

Similar Threads

  1. Horizontal Product Display (also purchased, featured products, category images)
    By jayhos in forum Templates, Stylesheets, Page Layout
    Replies: 14
    Last Post: 1 Feb 2011, 11:29 AM
  2. How can I display the categories of my products purchased?
    By bparker in forum Templates, Stylesheets, Page Layout
    Replies: 2
    Last Post: 24 Nov 2009, 08:24 PM
  3. High Parse Times - Query times OK
    By BodyJewels in forum General Questions
    Replies: 9
    Last Post: 25 Jun 2009, 07:19 AM
  4. Replies: 2
    Last Post: 2 Jun 2009, 05:51 AM
  5. golf tee-times or alotted dates/times as products?
    By SarahL in forum General Questions
    Replies: 4
    Last Post: 18 Jun 2007, 10:52 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •