No announcement yet.

Is this a good way to show related products on BASK?

  • Filter
  • Time
  • Show
Clear All
new posts

  • Bruce - PhosphorMedia
    yes, alphabet made a good point about duplicates.

    and yes, image handling in miva via imagemachine is an absolute bear.

    Leave a comment:

  • Mike521w
    Thanks Bruce - PhosphorMedia and alphabet, those are good points. Another consideration is that you may end up with a really long list of related items if there are multiple items in the cart. So for now I'm doing max of 3 per item, and no more than 12 total.

    I might end up with some sort of hybrid the custom field list + dedupe though.

    Also realized after posting yesterday's code snippet, for some reason I'm getting the wrong product images, while the titles / prices / links are correct. Seems like I'm using `
    ProductImage_Load_Type` incorrectly, however I checked the id's etc and everything looked good. Didn't have much time to look into it further so I deactivated it for now

    Leave a comment:

  • alphabet
    If there are more than one item in the basket:group you may be displaying the same related product several times or displaying a related product that is already in the basket which could be confusing to the user.

    You may need to add logic to display only unique items and to test if the related item is already in the basket.

    I'm not sure if miva has a unique sort function like _underscore but this comparison snippet may help:

    <mvt:foreach iterator="sort_rel_product" array="sort_rel_products">
    <mvt:assign name="" value="l.settings:sort_rel_product" />
    <mvt:assign name="g.uniquendx" value="g.uniquendx + 1" />
    <mvt:assign name="g.contrastndx" value="g.uniquendx + 1" />
    <mvt:item name="ry_toolbelt" param="assign|g.contrast|l.all_settings:sort_rel_products[g.contrastndx]" />
    <mvt:if expr=" NE g.contrast">
    <mvt:item name="ry_toolbelt" param="assign|l.all_settings:unique_rel_products[g.uniquendx]|" />
    <mvt:item name="ry_toolbelt" param="assign|g.array_elements|miva_array_collapse ( l.all_settings:unique_rel_products )" />

    Leave a comment:

  • Bruce - PhosphorMedia
    Nothing really built into shadows or even miva for that matter. Your approach sounds great if you don't need a difference between Related Products and Basket Upsell.

    The other general approach if you don't use the related products array is to just use a custom field with a character dilminated list of product codes and just step through those and call the product_load_code() function. (or use those codes to create a complete array structure so you can then just use mvt:foreach on l.settings:myUpsellItems)

    Leave a comment:

  • Is this a good way to show related products on BASK?

    Using Shadows, I tried adding the related_products item to the BASK page, but that didn't seem to do much. So I threw together some manual code to pull the related items and print out a basic list, but since I'm new to these frameworks / themes I'm wondering if this is the 'right' way to do it, or if there's a built-in thing that I should use instead?

    HTML Code:
       <div class="relatedProducts">
          <mvt:foreach array="basket:groups" iterator="group">
             <mvt:do file="g.Module_Feature_RPD_DB" name="l.success" value="RelatedProductList_Customer_Load_Product(g. basket:cust_id, l.settings:group:product:id, l.settings:relatedProducts)" />
             <mvt:foreach array="relatedProducts" iterator="relatedProduct">
                <mvt:assign name="l.uri:store_id" value="g.Store:id" />
                <mvt:assign name="l.uri:screen" value="''" />
                <mvt:assign name="l.uri:page_id" value="0" />
                <mvt:assign name="l.uri:cat_id" value="0" />
                <mvt:assign name="l.uri:product_id" value="l.settings:relatedProduct:id" />
                <mvt:do file="g.Module_Feature_URI_DB" name="l.have_uri" value="URI_Load_Item_Canonical( l.uri, l.settings:canonical_uri )" />
                <mvt:if expr="l.have_uri">
                   <a href="&mvt:canonical_uri:uri;" class="relatedProduct">
                         <mvt:do name="l.success" file="g.Module_Library_DB" value="ProductImage_Load_Type(l.settings:relatedProduct:id, 1, l.settings:main)" />
                         <mvt:do file="g.Module_Library_DB" name="l.success" value="GeneratedImage_Load_ID(l.settings:main:image_id, l.settings:thumb)" />
                         <img src="&mvt:thumb:image;" alt="&mvte:relatedProduct:name;">