List of On-Sale Items


Using RTML, you can create a page that automatically lists all the items in your store that are on sale. With this trick, you can add an On Sale Now page to your store without having to manually copy all the sale items into this page.

First, create a new section for the sale items. You can call this section On Sale Now or Sale Items or Clearance Items, or whatever else you think sounds good. After you have created this section, make a note of its ID.

Next, create a custom template called sale-items, as shown here:

Sale-items () YANK element nil      sequence FOR-EACH variable item                         sequence WHOLE-CONTENTS                   WITH-OBJECT item                     WHEN @sale-price                        id 


After this template has been set up, edit your copy of the page-body. template. Toward the bottom, you'll find the following block:

      WHEN @contents         WHEN OR                side-im                NONEMPTY @caption           LINEBREAK          CALL :contents.            @contents           wid         LINEBREAK  


warning

This template makes use of the WHOLE-CONTENTS operator. Besides being slow for stores with a large number of pages, WHOLE-CONTENTS has a minor issue: Pages that use WHOLE-CONTENTS aren't flagged automatically for regeneration. This means that if you change prices, for example, even though the on-sale page you set up using the previous example looks right in the editor, after publishing, the on-sale page won't be updated on the published site. You can fix this in two ways. Before publishing, either edit the on-sale page and, without changing anything, click the Update button, or click Variables and then click Update without changing any variables.


Paste the following after that block, replacing :saleitems with the ID of your Sale Items section:

      WHEN EQUALS value1 id                    value2 :saleitems         CALL :contents.           CALL :sale-items           wid         LINEBREAK 


Now you have a section that automatically lists all items in your store that are on sale. There is no need to manually add or remove items from this page.




Succeeding At Your Yahoo! Business
Succeeding At Your Yahoo! Business
ISBN: 0789735342
EAN: 2147483647
Year: N/A
Pages: 208

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net