Announcement

Collapse
No announcement yet.

Assigned Categories and Canonical URIs

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

    Assigned Categories and Canonical URIs

    I'm using this snippet to find the category a product is assigned to.

    Code:
    <mvt:do name="l.result" file="g.Module_Library_DB" value="CategoryList_Load_Offset_Product_Assigned(l .settings:product:id,0,'','',0,l.null, g.assigned_categories )" />
    
    <mvt:foreach iterator="category" array="global:assigned_categories">
    &mvt:category:active;<br>
    &mvt:category:code;<br>
    &mvt:category:id;<br>
    &mvt:category:name;<br>
    
    </mvt:foreach>
    I was even able to limit it to display a specific category code

    Code:
    <mvt:do name="l.result" file="g.Module_Library_DB" value="CategoryList_Load_Offset_Product_Assigned(l .settings:product:id,0,'','',0,l.null, g.assigned_categories )" />
    <mvt:foreach iterator="category" array="global:assigned_categories">
    <mvt:if expr="'Brand' CIN l.settings:category:code">
    <a href="/&mvt:category:code;.html"> link </a>
    <br>
    </mvt:if>
    </mvt:foreach>
    BUT I hit a gotcha - the site uses a slugified link for the Canonical URI. Is there a way to incorporate the ability to load the Category Canonical URI


    Code:
    <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="1" />
    <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">
    &mvt:canonical_uri:canonical; <br>
    &mvt:canonical_uri:cat_id;<br>
    &mvt:canonical_uri:page_id;<br>
    &mvt:canonical_uri:status;<br>
    &mvt:canonical_uri:store_id;<br>
    &mvt:canonical_uri:uri;<br>
    </mvt:if>
    Thanks!
    Leslie
    Last edited by lesliekirk; 09-17-20, 10:18 AM.
    Leslie Kirk
    Miva Certified Developer
    Miva Merchant Specialist since 1997
    Previously of Webs Your Way
    (aka Leslie Nord leslienord)

    Email me: [email protected]
    www.lesliekirk.com

    Follow me: Twitter | Facebook | FourSquare | Pinterest | Flickr

    #2
    Sure, just use:

    <mvt:do file="g.Module_Feature_URI_DB" name="l.success" value="URI_Load_Category_Canonical(cat_id, canonical_uri var)" />
    Bruce Golub
    Phosphor Media - "Your Success is our Business"

    Improve Your Customer Service | Get MORE Customers | Edit CSS/Javascript/HTML Easily | Make Your Site Faster | Get Indexed by Google | Free Modules | Follow Us on Facebook
    phosphormedia.com

    Comment

    Working...
    X