[ic] Addding Retail Price?

frank frank at goldissue.com
Wed Jan 14 23:52:24 EST 2004


Tom wrote:

>I want to add a retail price and your price, How do I do this what do I have
>to change in order for this to work? and on the pages I want it what do I
>put. Help would be appreciated thanks.
>
>_______________________________________________
>interchange-users mailing list
>interchange-users at icdevgroup.org
>http://www.icdevgroup.org/mailman/listinfo/interchange-users
>
>  
>
Hi Tom,

I have done something like this on all relevant pages/templates:

(This is the file templates/components/promo)

[comment]
ui_component: promo
ui_component_type: content, vertical
ui_component_group: promotion
ui_component_label: Promotion

promo_type:
    label: Promotion type
    widget: select
    column: featured
    table: merchandising

matches:
    label: Number to show
    widget: select
    options: 1,2,3*,4,5,6,7,8,9,10

cols:
    label: Columns
    options: 1,2,3*,4
    widget: select

banner:
    label: Banner for top box
    default: Specials
    widget: text
    width: 40

[/comment]

<!-- BEGIN COMPONENT [control component promo] -->
    <table width="95%" align=center>
<tr class="categorybar">
  <td class="categorybar" align="left"><b>[control banner Specials]</b></td>
</tr>
<tr>
  <td>
    [query arrayref=main
           sql="
               SELECT sku,timed_promotion,start_date,finish_date
            FROM [either]__UI_MERCH_TABLE__[or]merchandising[/either]
            WHERE featured = '[control promo_type specials]'
            "][/query]
    [perl tables="__UI_MERCH_TABLE__ merchandising"]
        my @out;
        my $ref;
        my $db;
        delete $Scratch->{promo_codes};
        my $date = $Tag->time( { body => '%Y%m%d' } );
        $ref = $Tmp->{main} or return;
        for(@$ref) {
            my $line = $_;
            push(@out, $line->[0]), next if ! $line->[1];
            next if $line->[2] gt $date;
            next if $line->[3] lt $date;
            push @out, $line->[0];
        }
        $Scratch->{promo_codes} = join(' ', @out);
        return;
    [/perl]
      <table width="100%" border="0" cellspacing="5" cellpadding="5" 
align="center">
    [table-organize embed=1 pretty=1 cols="[control cols 2]"]
[loop
    random="[control matches 3]"
    list="[scratch promo_codes]"
     ]
    [discount [loop-code]] $s * [loop-field discount] [/discount]

     <TD valign="top">
      <table border="0" cellspacing="0" cellpadding="0" 
bgcolor="#bcd4dd" height="250">
      <tr>
        <td align="center" colspan="2" class="contentbar1" width="280" 
height="30">
          <b>
          [if-loop-data merchandising blurb_begin]
            [loop-data merchandising blurb_begin]
          [else]
            [loop-description]
          [/else]
          [/if-loop-data]</b>
        </td>
      </tr>
   
      <tr>
        <td align="center" colspan="2">
          <a href="[area [loop-code]]"><img src="thumb/[loop-code].jpg" 
border="0"></a>
        </td>
      </tr>
    [if-loop-data merchandising blurb_end]
      <tr>
        <td align="center" colspan="2">
          <a href="[area [loop-code]]">[loop-data merchandising 
blurb_end]</a>
        </td>
      </tr>
    [else]
      <tr>
        <td align="center">
          <a href="[area [loop-code]]">More Info</a>&nbsp;
        </td>
        <td align="center">
          [if-loop-data options o_modular]
                [page [loop-code]]
                [else][order [loop-code]]
                [/else]
                [/if-loop-data]<img border="0" alt="buy now" 
src="__THEME_IMG_DIR__buynow.gif">[/order]
        </td>
      </tr>
    [/else]
    [/if-loop-data]
[if-loop-field sale_price]

      <tr>
        <td align="center" colspan="2">
          Sku:&nbsp;[loop-code]<br>Retail Price: <s>$[loop-field price]</s>
        </td>
      </tr>
      <tr>
        <td align="center" colspan="2">
          Sale Price: <b>[price code="[loop-code]" discount=1]</b>
        </td>
      </tr>
         [else]
[if-loop-field discount]
      <tr>
        <td align="center" colspan="2">
          Sku:&nbsp;[loop-code]<br>Retail Price: <s>[price 
code="[loop-code]" discount=0]</s>
        </td>
      </tr>
      <tr>
        <td align="center" colspan="2">
          Our Price: <b>[price code="[loop-code]" discount=1]</b>
        </td>
      </tr>
[else]
      <tr>
        <td align="center" colspan="2">
          Sku:&nbsp;[loop-code]<br>Our Price: [price code="[loop-code]" 
discount=0]
        </td>
      </tr>

[/else]
[/if-loop-field]


         [/else]
         [/if-loop-field]

      </table>
      </TD>
[/loop]
[/table-organize]
      </table>

      <p>&nbsp;</p>

  </td>
</tr>
</table>

<!-- END COMPONENT [control component promo] -->

The follwing alterration:

[if-discount [loop-code]
    [discount [loop-code]] $s * [loop-field discount] [/discount]
[/if]

or whatever the correct syntax is would probably be better - or you will 
get error messages in the log when the field discount in products.txt is 
empty.
There needs to be a column in products.txt with heading discount for 
this to work,

Frank.



More information about the interchange-users mailing list