Oncord Community Logo
    • Recent
    • Popular
    • Register
    • Login
    1. Home
    2. iwNZ
    3. Topics
    I
    • Profile
    • Following 0
    • Followers 0
    • Topics 2
    • Posts 2
    • Best 0
    • Controversial 0
    • Groups 0

    Topics created by iwNZ

    • I

      Pop up - "sign up to our newsletter and receive x% discount"

      Oncord Discussion
      • • iwNZ
      2
      0
      Votes
      2
      Posts
      169
      Views

      StephenBlignaultS

      @iwNZ See if you can get your answer from this page in the documentation: https://www.oncord.com/developer/api/controls/forms/dialogbox/

    • I

      Related products - "You may also like.."

      Oncord Discussion
      • • iwNZ
      2
      0
      Votes
      2
      Posts
      110
      Views

      StephenBlignaultS

      @iwNZ Hi there.

      I have implemented at least 2 very popular methods in the past.

      Option 1: (Moderate) Show all products from the current category
      Option 2: (Advanced) Custom Field called Related Products

      Option 1:
      On product detail template:

      <logic:variable as="arrCategoryIds" value="[? \Components\Commerce\Products\Categories::getAllIdsForProduct($product['product_id']) ?]" /> <logic:variable as="category" value="[? \Components\Commerce\Products\Categories::get($arrCategoryIds[0]) ?]" /> <div class="categoryRow"> <h2>Category Products <small>([? $category['product_category_title'] ?])</small></h2> <div class="shop-grid"> <logic:variable as="currentProduct" value="[? $product ?]" /> <data:repeater id="grid-product" class="grid-product-wrap" as="product" datasource="\Components\Commerce\Products::getAllForCategoryAndBrandRecursive($category['product_category_id'], null)" paging="true" pagingrows="20" pagingautorender="true" > <data:template component="\Components\Commerce\Products" type="list" /> </data:repeater> <logic:variable as="product" value="[? $currentProduct ?]" /> </div> </div>

      Option 2:
      This option is a lot more complicated:

      step 1 you need to create a custom field called Related Product Ids. Use a Custom UI type, and choose Text < 255 Characters. step 2 then on each product you select your related products step 3 add a data:repeater on the product detail page to list through the related product ids, a lot like what I showed in option 1.

      Your Custom UI code should look like this, or similar:

      <forms:row label="Related Products"> <logic:variable as="selected_product_ids" value="[? [] ?]" /> <logic:if test="$product['product_related_products']"> <logic:variable as="selected_product_ids" value="[? unserialize( $product['product_related_products'] ) ?]" /> </logic:if> <forms:selectlist id="product_related_products" datacolumn="product_related_products" value="" as="relatedProduct" width="300" height="120" style="font-size: 80%;"> <forms:option value=""></forms:option> <data:repeater as="relatedProduct" datasource="\Components\Commerce\Products::getAllConsole()"> <logic:if test="in_array($relatedProduct['product_id'], $selected_product_ids, false)"> <forms:option value="[? $relatedProduct['product_id'] ?]" title="[? $relatedProduct['product_title'] ?]" selected="selected" /> </logic:if> <logic:else> <forms:option value="[? $relatedProduct['product_id'] ?]" title="[? $relatedProduct['product_title'] ?]" /> </logic:else> </data:repeater> </forms:selectlist> <p style="margin-top: 8px;"><em><small>Hold CMD or Ctrl to select multiple products</small></em></p> </forms:row>

      Hope this sets you on the right path.