Announcement

Collapse
No announcement yet.

How can I schedule display/hide of assigned products to a category (Sale)?

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

    How can I schedule display/hide of assigned products to a category (Sale)?

    How can I schedule assigned/unassigned or display/hide of assigned products to a category (Sale)?
    Thank you, Bill Davis

    #2
    Is this possible, if so how?

    Perhaps a conditional within the Category Display page (CTGY) > Template, perhaps something like this the following example (but i need a little help)?

    Code:
    <mvt:if <!-- category page equal "sale",  Whats the code for this? --> />
    
    <mvt:do file="g.Module_Feature_PGR_DB" name="l.ok" value="PriceGroup_Load_Name( '20170620-20170625-CAMPAIGN_NAME', l.price_group )" />
    
    <mvt:assign name="g.var" value="miva_array_serialize(l.price_group)" />
    
    <mvt:if expr="s.dyn_time_t GE l.price_group:dt_start AND s.dyn_time_t LE l.price_group:dt_end">
        <mvt:comment>
            Load seasonal promo param; Image, Banner or Content Section item tag code below between HTML "li" (list) tags.
        </mvt:comment>
    
        <mvt:item name="subcategory_listing" />
        <mvt:if expr="l.settings:category_product_count GT 0">
            <mvt:item name="category_listing" />
        </mvt:if>
    </mvt:if>
    </mvt:if>
    Last edited by William Davis; 06-19-17, 01:32 PM.
    Thank you, Bill Davis

    Comment


      #3

      price_group:dt_start is a unix time value so you need to use: <mvt:do file="g.Module_Feature_PGR_DB" name="l.ok" value="PriceGroup_Load_Name( '20170620-20170625-CAMPAIGN_NAME', l.SETTINGS:price_group )" /> <mvt:assign name="l.settings:myStartTime" value="(mktime_t( year, month, dayofmonth, hours, minutes, seconds, 'local')"/> <mvt:if expr="l.settings:myStartTime" GE l.settings:price_group:dt_start"> show discount promo </mvt:if>
      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


        #4
        Thanks Bruce, it was just an idea as I am new to M5-9, not at all familiar with the new script (...big change from OpenUI).

        What I need a is a way to schedule assign/unassigned products to sale category or display/hide product display from sale category using price groups.

        Since I could not come up with a way to use price groups to schedule the assignment/unassigned products to a category, I thought of wrapping a price group conditional code around the product display in the category page template, unless of course there is a simpler way.

        If there is no simpler way, I would like to use a price group conditional to work only in the sale category (not in other categories), but I don't know what kind of code I need to use to run only in sale category (e.g.: IF category="sale" use price group conditional to either display or hide product display /IF). Don't laugh I know its crude but I am learning, but I know you understand what I meant.

        Any suggestions (...in run Jane run see Spot jump)?
        Thank you, Bill Davis

        Comment


          #5
          for now, that's about as close as you can get. im sure as time goes on miva will expand the 'scheduling' system to include features like this.
          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


            #6
            What code do I use to validate IF category="sale"?
            Thank you, Bill Davis

            Comment


              #7
              For the current category, it's just <mvt:if expr="l.settings:category:code EQ 'Sale'">.
              But if you need to test if a product is IN a the sale category you need to use:
              <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.theseCategories)" />

              <mvt:foreach iterator="thisCategory" array="global:theseCategories">

              <mvt:if expr="l.settings:thisCategory:code EQ 'Sale'">

              is in sale category

              <mvt:else>

              is not

              </mvt:if>


              </mvt:foreach>
              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


                #8
                Bruce ran in to the following error:

                Error compiling template: At 29:1-29:68 - MVT:FOREACH with no matching end
                Home > Edit Page: Category Display (CTGY) > Page

                Template (New code between ...):
                Code:
                <mvt:item name="html_profile" />
                <head>
                <mvt:if expr="NOT ISNULL l.settings:category:page_title">
                    <title>&mvt:category:page_title;</title>
                <mvt:elseif expr="NOT ISNULL l.settings:page:title">
                    <title>&mvt:page:title;</title>
                <mvt:else>
                    <title></title>
                </mvt:if>
                <mvt:item name="head" param="head_tag" />
                    <mvt:if expr="g.CatListingOffset OR g.CatListingNextOffset">
                        <mvt:if expr="g.CatListingOffset GT 0">
                            <link rel="prev" href="&mvte:category:link;?CatListingOffset=&mvta:global:CatListingPrevOffset;" />
                        </mvt:if>
                        <mvt:if expr="g.CatListingNextOffset GT 0">
                            <link rel="next" href="&mvte:category:link;?CatListingOffset=&mvta:global:CatListingNextOffset;" />
                        </mvt:if>
                    </mvt:if>
                </head>
                <body id="js-&mvte:page:code;" class="<mvt:eval expr="tolower(l.settings:page:code)" /> &mvte:category:code;">
                    <mvt:item name="hdft" param="global_header" />    
                    <div class="row hdft-header">
                        <mvt:item name="hdft" param="header" />
                    </div>
                    <div class="row prod-ctgy-hdft-header">
                        <mvt:item name="prod_ctgy_hdft" param="ctgy_header" />
                    </div>
                
                ...
                <mvt:foreach iterator="thisCategory" array="global:theseCategories">
                <mvt:if expr="l.settings:thisCategory:code EQ 'Sale'">
                    <mvt:do file="g.Module_Feature_PGR_DB" name="l.ok" value="PriceGroup_Load_Name( 'TEST', l.price_group )" />
                    <mvt:assign name="g.var" value="miva_array_serialize(l.price_group)" />
                        <mvt:if expr="s.dyn_time_t GE l.price_group:dt_start AND s.dyn_time_t LE l.price_group:dt_end">
                            <mvt:item name="subcategory_listing" />
                            <mvt:if expr="l.settings:category_product_count GT 0">
                                <mvt:item name="category_listing" />
                            </mvt:if>
                                Sorry sale is over, don't miss on another sale and join our newsletter to receive the latest news on new promotions, exclusive offers, and new arrivals!
                             <mvt:else>
                        </mvt:if>
                <mvt:else>
                    <mvt:item name="subcategory_listing" />
                    <mvt:if expr="l.settings:category_product_count GT 0">
                        <mvt:item name="category_listing" />
                    </mvt:if>
                </mvt:if>
                ...
                
                
                    <div class="row prod-ctgy-hdft-footer">
                        <mvt:item name="prod_ctgy_hdft" param="ctgy_footer" />
                    </div>
                    <div class="row hdft-footer">
                        <mvt:item name="hdft" param="footer" />
                    </div>
                    <mvt:item name="hdft" param="global_footer" />    
                </body>
                </html>
                Last edited by William Davis; 06-20-17, 03:30 PM.
                Thank you, Bill Davis

                Comment


                  #9

                  <mvt:item name="subcategory_listing" /> <mvt:if expr="l.settings:category_product_count GT 0"> <mvt:item name="category_listing" /> </mvt:if> Sorry sale is over, don't miss on another sale and join our newsletter to receive the latest news on new promotions, exclusive offers, and new arrivals! <mvt:else> Should be
                  <mvt:item name="subcategory_listing" /> <mvt:if expr="l.settings:category_product_count GT 0"> <mvt:item name="category_listing" /> <mvt:else> Sorry sale is over, don't miss on another sale and join our newsletter to receive the latest news on new promotions, exclusive offers, and new arrivals! </mvt:if> i think...this is done from memory and not tested...but then, its not billable time either :)
                  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


                    #10
                    Originally posted by Bruce - PhosphorMedia View Post
                    <mvt:item name="subcategory_listing" /> <mvt:if expr="l.settings:category_product_count GT 0"> <mvt:item name="category_listing" /> </mvt:if> Sorry sale is over, don't miss on another sale and join our newsletter to receive the latest news on new promotions, exclusive offers, and new arrivals! <mvt:else> Should be
                    <mvt:item name="subcategory_listing" /> <mvt:if expr="l.settings:category_product_count GT 0"> <mvt:item name="category_listing" /> <mvt:else> Sorry sale is over, don't miss on another sale and join our newsletter to receive the latest news on new promotions, exclusive offers, and new arrivals! </mvt:if> i think...this is done from memory and not tested...but then, its not billable time either :)
                    Thanks you,

                    I think I fixed the first error by adding another </MVT:IF>:
                    Error compiling template: At 31:1-31:8 - MVT:IF with no matching end
                    Then I got a second error, so I added </MVT:FOREACH>:
                    Error compiling template: At 30:1-30:68 - MVT:FOREACH with no matching end
                    Errors are now all gone, but the code did not seem to work.

                    Thank you for trying.
                    Last edited by William Davis; 06-21-17, 03:05 PM.
                    Thank you, Bill Davis

                    Comment


                      #11
                      Thanks Bruce, but I was never able to get it to work.

                      Maybe someone else has a solution?
                      Thank you, Bill Davis

                      Comment


                        #12
                        cause you never create the Categories Assigned to Products array (g.theseCategories) using:
                        <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.theseCategories)" />
                        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


                          #13
                          Originally posted by Bruce - PhosphorMedia View Post
                          cause you never create the Categories Assigned to Products array (g.theseCategories) using:
                          <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.theseCategories)" />
                          Thanks Bruce I appreciate your help, but having migrated from MM4.24c a several months ago I don't understand you meant. So I guess I will table the matter for now until I learn how to write MIVA code so I can use it on our store.
                          Thank you, Bill Davis

                          Comment

                          Working...
                          X