[ic] Inventory for options

Michael Michaelsen interchange-users@lists.akopia.com
Sun Aug 5 13:45:01 2001


Great Mike! This actually helped me with my next step also. I wanted to show a little image with the color next to the buy buttons and it was very easy after getting your code.

Is there any way to include a drop down menu with the sizes?
I do not want to keep track on inventory in sizes, only a few of my items comes in different sizes.

This is the code I have now:

<FORM ACTION="[area order]" METHOD=POST>
  <INPUT TYPE=hidden  NAME="mv_order_item"  VALUE="[item-code]">
  <input type=hidden name=mv_session_id value="[data session id]">

  <table width="70%" border="0" cellspacing="0" cellpadding="5">
  <tr valign="middle"> 
    <td align=center class="contentbar1">
      <big>[item-field category] : <b>[item-description]</b></big>
    </td>
  </tr>
  <tr valign="middle"> 
    <td align=center> 
      <table cellspacing=0 cellpadding=3 align=center>
      <tr> 
	<td valign="center" align="left"> 
	  [if-item-field image]
	    <IMG SRC="items/[item-field image]" ALT="[item-filter entities][item-description][/item-filter]" title="[item-filter entities][item-description][/item-filter]" BORDER=0>
 	  [/if-item-field]
	</td>
	<td valign="center" align="center"> 
	  <table width="100%" border="0" cellpadding="3" cellspacing="0">
	  <tr>
	    <td colspan="2">
	      [item-field comment]
	    </td>
	  </tr>
	  [if file products/specs.txt]
	  [loop search="
	  	fi=specs.txt
		st=text
		sf=sku
		se=[item-code]
		op=eq
		co=yes
		rf=header,detail
	  "][on-match]
		<tr>
	    <td style="contentbar1" colspan=2><img src="bg.gif" alt="" height=3>
		</tr>
	  [/on-match]
	  [list]<tr>
	    <td style="contentbar1">
	      <B>[loop-param header]:</b>
	    </td>
	    <td>
	      [loop-param detail]
	    </td>
	  </tr>
	  [/list]
	  [on-match]
		<tr>
	    <td style="contentbar1" colspan=2><img src="bg.gif" alt="" height=3>
		</tr>
	  [/on-match]
	  [/loop]
	  [/if]
	  <tr> 
	    <td colspan="2">&nbsp;</td>
	  </tr>
	  [if-item-data options o_modular]
	  <tr>
	    <td colspan="2">
	      [if ordered [item-code]]
	        This item is currently in your [page ord/basket]shopping cart</a>.
	        <br>
	      [/if]
	      [if-item-data options o_modular]
	        [set arg][item-code][/set]
	        [include templates/components/modular_buy]
	      [/if-item-data]
	    </td>
	  </tr>
	  [/if-item-data]			 
	  <tr>
  	    [if-item-data options o_matrix]
	[query
	    list=1
	    sql=" SELECT code FROM options
 		  WHERE sku = '[item-code]'
		  AND   o_matrix = 1 "]
	<tr>Size: [item_accessories size]
<td align="center"><img border="0" src="http://www.mydomain.com/shop/images/[sql-data options description].gif" alt="[sql-data options description]">
</td>
	    <td>[if-sql-data inventory quantity > 0]
			    [page
				    href=order
				    form="  mv_order_item=[item-code]
					    mv_sku=[sql-code]
				    "]<img border="0" src="http://www.mydomain.com/shop/images/foundation/buynow.gif" alt="Buy it Now!"></A>
		      [else]
			    OUT OF STOCK
                <br>
	        <a href="[area stock-alert [item-code]]">In-Stock Notification</a>
		      [/else]
		      [/if-sql-data]
	    </td>
	    </tr>
	    [/query]
      [/if-item-data]
	    </tr>
	  </table>
	</td>
      </tr>
      </table>
    </td>
  </tr>
  <tr>
    <td class="contentbar1">

	<table width="100%">
	<tr>
	  <td align="center">
      		Item#: [item-code]     -   Price: <b>[item-price]<b>
	  </td>
	  </tr>
	</table>

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

</form>

Regards
Mike



Quoting MITECH Trading (michaelsen@spacey.net):
> SKU# 00007 comes in red and blue. I have made matrix options for that and
> get
> 00007red and 00007blue with each their quantities on hand.
> When one of the colors is out of stock, there is no out of stock notice
> comming up.
> The out of stock notice is controlled by 00007, and in this case the 00007
> inventory never change. Only 00007red and 00007blue change when items is
> purchased.
> 
> Are there any way to get a out of stock notice when one of the colors is out
> of stock?
> 

Sure, but it isn't in the standard flypage. Try this:

      [if-item-data options o_matrix]
	[query
	    list=1
	    sql="
		  SELECT code FROM options
 		  WHERE sku = '[item-code]'
		  AND   o_matrix = 1
	    "]
	<tr>
	    <td>[sql-data options description]</td>
	    <td>-- [if-sql-data inventory quantity > 0]
			    [page
				    href=order
				    form="
					    mv_order_item=[item-code]
					    mv_sku=[sql-code]
				    "]ORDER NOW</A>
		      [else]
			    OUT OF STOCK
		      [/else]
		      [/if-sql-data]
	    </td>
	    </tr>
	    [/query]
      [/if-item-data]

-- 
Red Hat, Inc., 3005 Nichols Rd., Hamilton, OH  45013
phone +1.513.523.7621      <mheins@redhat.com>

"Even if you're on the right track, you'll get run over if you just
sit there." -- Will Rogers
_______________________________________________
interchange-users mailing list
interchange-users@lists.akopia.com
http://lists.akopia.com/mailman/listinfo/interchange-users