Im currently working on a mod making it possible to only allow customers from a certain zone to see/buy a product...
IE:
Your store sells gift-items. You would like the whole world to buy these!
But you also sell baked goods. You would not want to send those half way around the world!
So what my mod does is this:
When you add (or edit) a product you can select a specified zone for that product. (If none is selected, product will be visible to all)
Then when a customer visits your store he will only see the items he can purchase in his zone! (And all items that dont have any zone specified)
But I have a problem...
When I hide a item cause of the zone, it just "blanks" out... IE: In Latest Products there are by default 9 items, and if one of them is hidden because of the zone that item "blanks" out, and there are only shown 8 items! :-/
Live example
My code (catalog\view\theme\default\template\module\latest_home.tpl)
Code: Select all
<?php if ($products) { ?>
<div class="top">
<div class="left"></div>
<div class="right"></div>
<div class="center">
<div class="heading"><?php echo $heading_title; ?></div>
</div>
</div>
<div class="middle">
<table class="list">
<?php for ($i = 0; $i < sizeof($products); $i = $i + 4) { ?>
<tr>
<?php for ($j = $i; $j < ($i + 4); $j++) { ?>
<td style="width: 25%;"><?php if (isset($products[$j])) { ?>
<!-- Zone-check -->
<?php if (($address['zone_id'] == $products[$j]['zone']) || ($products[$j]['zone'] == '0')) { ?>
<!-- Zone-check end -->
<a href="<?php echo str_replace('&', '&', $products[$j]['href']); ?>"><img src="<?php echo $products[$j]['thumb']; ?>" title="<?php echo $products[$j]['name']; ?>" alt="<?php echo $products[$j]['name']; ?>" /></a><br />
<a href="<?php echo str_replace('&', '&', $products[$j]['href']); ?>"><?php echo $products[$j]['name']; ?></a><br />
<span style="color: #999; font-size: 11px;"><?php echo $products[$j]['model']; ?></span><br />
<?php if ($display_price) { ?>
<?php if (!$products[$j]['special']) { ?>
<span style="color: #900; font-weight: bold;"><?php echo $products[$j]['price']; ?></span>
<?php } else { ?>
<span style="color: #900; font-weight: bold; text-decoration: line-through;"><?php echo $products[$j]['price']; ?></span> <span style="color: #F00;"><?php echo $products[$j]['special']; ?></span>
<?php } ?>
<a class="button_add_small" href="<?php echo $products[$j]['add']; ?>" title="<?php echo $button_add_to_cart; ?>" > </a>
<?php } ?>
<br />
<?php if ($products[$j]['rating']) { ?>
<img src="catalog/view/theme/default/image/stars_<?php echo $products[$j]['rating'] . '.png'; ?>" alt="<?php echo $products[$j]['stars']; ?>" />
<?php } ?>
<!-- Zone-check -->
<?php } ?>
<!-- Zone-check end -->
<?php } ?></td>
<?php } ?>
</tr>
<?php } ?>
</table>
</div>
<div class="bottom">
<div class="left"></div>
<div class="right"></div>
<div class="center"></div>
</div>
<?php } ?>