Announcement

Collapse
No announcement yet.

Replacing Toolkit Bestseller Functionality

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Replacing Toolkit Bestseller Functionality

    Is there a way to replace (hopefully without too much difficulty) the Toolkit function, bestseller_recent, with standard miva code? I am ok with using it but want to phase out toolkit when possible per miva's recommendation.

    From the toolkit documentation (https://apps.miva.com/emporium-plus-...tml#devInfoTab):
    138. Use
    bestseller_recent
    to list the best sellers in a specific category for the past X number of days. NOTE: This function only works in MySQL stores. It does not work in MivaSQL stores. For example,

    Code:
     
    <mvt:item name="toolkit" param="bestseller_recent|pcount|g.Category_Code|5| 30|1|U" /> <mvt:if expr="pcount GT 0"> Best Sellers <mvt:foreach iterator="bestsell" array="bestseller"> <br> <a href="&mvt:global:sessionurl;Screen=PROD&Product_C ode=&mvta:bestsell:code;&Store_Code=&mvta:store:co de;"> &mvte:bestsell:name;<a> &mvte:bestsell:formatted_price; </mvt:foreach> </mvt:if>
    shows the best sellers in the current category. The 4th parameter is the number of items to display, e.g. 5. The 5th parameter is the number of days back the count will include, e.g. 30.

    Alternatively you can display the best sellers storewide by changing the 3rd parameter to the word ALL, i.e. replace g.Category_Code with ALL in the above example. You can even include the actual number sold if you want your customers to know how popular the items are by using the variable &mvte:bestsell:counter; Optionally you can put a 1 as the 6th parameter to hide out of stock products. Leave it blank if you want to include out of stock products. Optionally you can exclude one string from the product code to hide products in the 7th parameter. For example, if you want to hide catalogs, gift certificates, etc, put a unique string in their product code and they will not appear in the list.

    #2
    davdg75 There is not an exact duplicate of the function but you can get close using the BestSellerList_Load_Offset function: https://docs.miva.com/api-functions/...st_load_offset

    This function will load the bestsellers of the store. You can add something like this:
    Code:
    <mvt:assign name="l.nextoffset" value="5" />
    <mvt:do file="g.Module_Feature_STA_DB" name="l.success" value="BestSellerList_Load_Offset(0, 0, l.nextoffset, l.settings:best_products)" />
    Nicholas Adkins
    Technical Training Specialist / Miva, Inc.
    [email protected]
    https://www.miva.com/mivalearn

    Comment


      #3
      davdg75 if you wanted the best sellers in the category/store you could use a template function to pull in the list of products then use Runtime_ProductList_Load_Offset_Search_Sort to sort the results. Something like this: https://gist.github.com/steveosoule/...2459b55e37b3bc
      Nicholas Adkins
      Technical Training Specialist / Miva, Inc.
      [email protected]
      https://www.miva.com/mivalearn

      Comment

      Working...
      X