Forums / General Questions / I want to add another New Button on Product Information page

I want to add another New Button on Product Information page

Locked

Started by barrow_matt on 16 Feb 2010, 7:15 PM · Views: 882

Results 1 to 3 of 3
This thread is locked. New replies are disabled.
16 Feb 2010, 7:15 PM
#1
barrow_matt avatar

barrow_matt

New Zenner

Join Date:
Feb 2010
Posts:
18
Plugin Contributions:
0

I want to add another New Button on Product Information page

Hi,

I am currently modifying my store and need to place a button on the Product Information Pages in addition to the Add to Cart Button.

I believe the correct location is /includes/templates/MY_TEMPLATE/templates/tpl_product_info_display.php

What I have at the moment is a standalone HTML solution

<?php

require('includes/application_top.php');

// create a product list
	$product = $db->Execute("select p.products_id, pd.products_name, p.products_price, p.products_priced_by_attribute
                             from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd
                             where p.products_id = pd.products_id
                             and pd.language_id = '" . (int)$_SESSION['languages_id'] . "'
                            ");
?>

<html>
<form method="post" action="auctionit.php">
<div>

<select class="selectBox" name="select" size="10">
<?php 
  while(!$product->EOF) {
	echo '<option value="' . $product->fields['products_id'] . '">' . $product->fields['products_name'] . '</option>';
	$product->MoveNext();
  }
?>
</select>

<input type="submit" name="Submit" value="Create Listing">

</div>
</form>
</html>

This creates a selection list box with every product in, you can select a product and click submit and auctionit.php loads and I can use $result = $_POST['select']; to pick up the product id and continue with the task.

What I want to achieve is have the button on the product information page which then loads auctionit.php with access to the products id.

Since the Add to Cart button is in an Add to Cart form in the Product Display file how do I add a new button with a separate form?

Do I simply nest a form within the add to cart form?

I would also like to launch auctionit.php in a new window?

For info I run a dropshipping website so the button creates a fully formatted eBay ready listing with product information placed within a template and custom payment/shipping/contact text which I have modifed the Account area and used a new table to store.

Thanks,

Matt

17 Feb 2010, 3:30 PM
#2
barrow_matt avatar

barrow_matt

New Zenner

Join Date:
Feb 2010
Posts:
18
Plugin Contributions:
0

Re: I want to add another New Button on Product Information page

I tried a nested form but that didn't work, the item was added to the cart when clicked.

I've placed a new form at the bottom of the page after the Add to Cart form closes which is acceptable.

The code I have is:

<!--bof Auto Auction Listing -->
<?php
if (CUSTOMERS_APPROVAL == 3 and TEXT_LOGIN_FOR_PRICE_BUTTON_REPLACE_SHOWROOM == '') {
  // do nothing
} else {
?>

    <form method="post" action="auctionit.php">
	<input type="hidden" name="select" value="<?php (int)$_GET['products_id'] ?>">
	<input type="submit" name="Submit" value="Create Listing">
	</form>

<?php } // CUSTOMERS_APPROVAL == 3 ?>
<!--eof Auto Auction Listing-->

Two problems with this:

  1. The button is still displayed when a customer is not logged in?

  2. The products_id is not being passed correctly. I tried a number in here so know it does work with a fixed id.

I expect both issues are linked to not having access to those values outside of the Add to Cart form in the tpl_product_info_display.php file?

Can anyone please advise?

Regards,

Matt

17 Feb 2010, 4:00 PM
#3
barrow_matt avatar

barrow_matt

New Zenner

Join Date:
Feb 2010
Posts:
18
Plugin Contributions:
0

Re: I want to add another New Button on Product Information page

Fixed number 2. It was missing an echo to write the value into the HTML. DOH!

<input type="hidden" name="select" value="<?php echo (int)$_GET['products_id']; ?>">

Not sure about Number 1 though?

Matt