Custom Fields for Shopp Products

I’ve been using the Shopp plugin for WordPress on a site I’m developing. There are a lot of great things about Shopp; I’m planning a post in the coming weeks comparing Shopp and WP-ecommerce.

The latest problem I’ve been working out is how to add custom form fields for each product. Rickrackbaby.com offers custom monogramming, so I need a place for visitors to type in their custom text. To make it trickier, I actually need two custom fields for each product.

After weeks of going to ridiculous lengths to add two fields AND output their data to the receipt, I stumbled on the answer. Turns out there’s a tutorial in the forums that many, many searches did not turn up. Here’s hoping that this post is easier to Google than that one.

First thing is to add this line of code to product.php (I added it at line 39 after my variations):

<label>Your Name</label><?php shopp(‘product’,’input’,’name=Inscribed Name’); ?>

Then you’ll need to print the input data to your receipt.php and cart.php pages. This is the line you’ll need to add:

<?php shopp(‘cartitem’,’input-list’); ?>

Last but not least, you want to add the following to receipt.php:

<?php shopp('purchase','item-inputs-list'); ?>

And that’s it! Again, the original post is here. Happy Shopp-ing!

EDIT: That code did not work for me on receipt.php. This, on the other hand, did the trick.

<?php if(shopp('purchase','item-hasinputs')): ?>
	<ul>
	<?php while(shopp('purchase','item-inputs')): ?>
		<li><?php shopp('purchase','item-input','name'); ?>: <?php shopp('purchase','item-input'); ?></li>
	<?php endwhile; ?>
	</ul>
<?php endif; ?>

Leave a Reply

Your email address will not be published.

*