Small help with IF

Hi all,
I run a webstore and would like to add a small feature to it.

Some of the products I actually would like to be only visible in the store but NOT for sale. So this is how it looks:

[php]<?php if (!_xls_get_conf('DISABLE_CART', false)): ?>

<?php if (_xls_get_conf('ENABLE_GIFT_REGISTRY', 0)): ?>
<div class="wishlist" <?php  $this->misc_components['show_gift_registry']->RenderAsEvents('show') ?>>
		<a href="#" ><?php _xt("Add to Wish List"); ?></a>
</div>
<?php endif; ?>
misc_components['add_to_cart']->RenderAsEvents($this->prod->Code) ?>> <?php _xt("Add to Cart"); ?>
<?php $this->giftRegistryPnl->Render(); ?>
<?php if (!_xls_get_conf('DISABLE_CART', false)): ?>
<?php $this->txtQty->Render(); ?>
<?php endif; ?>[/php]

There is a feature in the system where you can add a KEYWORD to each product. So I though I could add something like “phone_only” as a keyword to those product than can only be purchased over phone or in physical store. Can the code the be:

[php]<?php if (<?php $this->prod->WebKeyword3('phone_only', false)): ?>

misc_components['add_to_cart']->RenderAsEvents($this->prod->Code) ?>> <?php _xt("Add to Cart"); ?>
<?php endif; ?> [/php]

I tried it and it didn’t work. (white screen).Can anyone help?
My wishes would be:
a) The “Add to Cart” button is replaced by “Phone Only” text, which you can not click on
b) The “Add to Cart” button is simply removed.

thanks,
HakonOrri

i think it should be like the below code instead:
[php]

<?php if ($this->prod->WebKeyword3('phone_only') == false) { ?>
<div class="addcart" <?php $this->misc_components['add_to_cart']->RenderAsEvents($this->prod->Code) ?>>
	<a href="#"><?php _xt("Add to Cart"); ?></a>
</div>
<?php }?>

[/php]

This code didn’t work for me. Instead of the white screen I got the products up, but no background or styles.

I found another solution which worked for me.
[php]<a class="<?php echo $this->prod->WebKeyword3 ?>" href="#"

<?php $this->misc_components['add_to_cart']->RenderAsEvents($this->prod->Code) ?>>
<?php _xt("ADD TO CART"); ?>

[/php]

then I added this to my CSS file

.phone_only { display: none;}

Seems to working… so thanks for your help

Sponsor our Newsletter | Privacy Policy | Terms of Service