Page 1 of 1

[vQmod] - Password Protect Add to Cart (v1.5.x)

Posted: Sat Jan 28, 2012 5:36 am
by Qphoria
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 5553 times


Re: [vQmod] - Password Protect Add to Cart (v1.5.x)

Posted: Mon May 07, 2012 3:30 am
by fotoshootoplocatienl
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 -->