Post by Qphoria » Sat Jan 28, 2012 5:36 am

This will allow you require a password per-product when clicking Add to Cart.

It lets you to use the "Location" field in your product edit area as a password field.
If there is something in the location field, it assumes that to be the product password
It will prompt you to enter the correct password.
If you enter it correctly, it will add to the cart
If you enter it incorrectly, it will throw an error
If the location field is blank, it won't prompt for password.

You can change the prompt and error message in the xml file
product_password_protect_atc.gif

product_password_protect_atc.gif (131.27 KiB) Viewed 5544 times

Attachments


Image


User avatar
Administrator

Posts

Joined
Tue Jul 22, 2008 3:02 am

Post by fotoshootoplocatienl » Mon May 07, 2012 3:30 am

Hi Qphoria,

I have tried this mod, and the if password does not match works perfect. However when the password is successful it does not add it to the cart.

Now I think it has to do something with the fact I have enabled If out of stock then disable order button. See the VQMOD code below for product.tpl.

Can you help me with modifying the code so that I can use the password function?

Code: Select all

<!-- Remove from product pages -->
	<file name="catalog/view/theme/*/template/product/product.tpl">
		<operation error="skip"><!-- v15x -->
            <search position="replace"><![CDATA[
            <input type="button" value="<?php echo $button_cart; ?>" id="button-cart" class="button" />
            ]]></search>
            <add trim="true"><![CDATA[
            <?php if ($product_info['quantity'] == 0 || ($product_info['quantity'] < 0 && !$this->config->get('config_stock_checkout')) ) { ?>
			
			<input onclick="return;" type="button" value="Het is niet mogelijk toegangskaarten te bestellen voor deze Fotoshootdag" class="button" />
			<?php } elseif ($product_info['quantity'] < 0 && $this->config->get('config_stock_checkout')) { ?>
			<a id="button-cart" class="button"><span><?php echo $this->language->get('button_pre_order'); ?></span></a>
			<?php } else { ?>
			<input type="button" value="<?php echo $button_cart; ?>" id="button-cart" class="button" />
			<?php } ?>
            ]]></add>
        </operation>
		
		<operation error="skip"><!-- v15x -->
            <search position="replace" index="2"><![CDATA[
             <a onclick="addToCart('<?php echo $product['product_id']; ?>');" class="button"><?php echo $button_cart; ?></a></div>
            ]]></search>
            <add trim="true"><![CDATA[
            ]]></add>
        </operation>
	</file>
	<!-- END BLOCK -->


Posts

Joined
Mon Mar 21, 2011 7:54 pm
Location - Kudelstaart (Aalsmeer), The Netherlands
Who is online

Users browsing this forum: No registered users and 8 guests