Jump to content

Archived

This topic is now archived and is closed to further replies.

Guest

Buy Button on Category Page

Recommended Posts

Guest

Hello guys

I followed freshyseth's instructions, and when a buy button that belongs to a product which does not have options was clicked from the viewCat page, the browser was indeed redirected to the same category page. However, I need it to do the same for products which do have options.

I hired someone to do some work on the store, and the product options are now displayed on viewCat. I'm trying to work out how to get the buy button to directly add the product, with chosen options, to the cart.

Here's what I've done:

Changed the viewCat.tpl buy_btn section from:

			<p><form action="{CURRENT_URL}" method="post" name="prod{PRODUCT_ID}">

				<!-- BEGIN: buy_btn -->

					<input type="hidden" name="add" value="{PRODUCT_ID}" />

					<div style="position: relative; text-align: right;">{LANG_QUAN} 

					<input name="quan" type="text" value="1" size="2" class="textbox" style="text-align:center;" />

					<a href="java script:submitDoc('prod{PRODUCT_ID}');" target="_self" class="txtButton">{BTN_BUY}</a></div>

				<!-- END: buy_btn -->

			</form></p>



to:




			<p><form action="{CURRENT_URL}" method="post" name="addtobasket">

				<!-- BEGIN: buy_btn -->

					<input type="hidden" name="add" value="{PRODUCT_ID}" />

					<input type="hidden" name="location" value="act=viewCat&catId={CAT_ID}&page={PAGE_NUM}" />

					<input type="text" name="quan" value="1" size="1" />

					<a href="java script:submitDoc('addtobasket');" class="txtButton">{BTN_BUY}</a>

				<!-- END: buy_btn -->

			</form></p>



This results in the following javascript error:




findObj(formName).submit is not a function

http://www.thegraphicedge.me.uk/js/jslibrary.js

Line 41

:unsure:

If anyone can help me add what I need to the viewCat page to get the direct add to work I'd appreciate it. Thanks.

Share this post


Link to post
Share on other sites

Guest bennyuk

the <form> tag needs to cover the options as well, fix has been sent...

Share this post


Link to post
Share on other sites
Guest nymyth

markscarts - that worked out great mate....THANKS

Share this post


Link to post
Share on other sites
Guest nymyth

ended up using Convicts, it works better......

Share this post


Link to post
Share on other sites
Guest cornholio27

Have been trying Convict's code, which seems to work great by keeping the user on the cat page.

However, If you go into the viewprod page then try and go back via the browser button you now get the message warning about the page containing 'POST' data. So, if you click OK to go back the product is added again to the cart.

Any suggestions how to get round this?

thanks in advance

Share this post


Link to post
Share on other sites
Guest

I've never noticed that before!

As for a suggestion to get around it... sorry I wouldn't know where to begin :mellow:

Share this post


Link to post
Share on other sites

MarksCarts mod suits me fine too. :mellow: Thank you very much.

One little thing missing. It jumps back to the first page in the category. Did anyone figure out how to get it to jump back to the same page. (i.e., If the customer clicks Buy on an item on page 4 of 5 it should jump back to that page and not the first page. The pages are zero indexed so page 4 will have page=3 in the URL.) The answer may be related to PAGINATION in viewCat.inc.php.

Share this post


Link to post
Share on other sites
Guest alexjones

If anyone can help me, I installed the mod but i get the session problem. The buy button works only sometimes.

Can you tell me how can I fix this?

Thank you,

Alex

Share this post


Link to post
Share on other sites
Guest safefast

Convict, you're a genius!

Share this post


Link to post
Share on other sites

×
×
  • Create New...