Home Forums Plugins Add to Wishlist Support [Resolved] Can you add to cart from wishlist?

Welcome to our community support forums! We're here to help - but if you have an urgent request for a Pro Plugin, you will get a prioritised response through our Premium Support page.

Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #6456
    ozoneboy
    Participant

    The wishlist has an “update quantity” function (that doesn’t appear to do anything?) but there’s no “add to cart” button. Does the user have to view the product page before adding to cart?

    #6457
    ozoneboy
    Participant

    FYI: I managed to create an add-to-cart function by inserting the add-to-cart shortcode with product-id to the end of this form action:

    <form action="<?php echo $wishlist_url; ?>" method="POST">
    		<input type="text" name="quantity" value="<?php echo $favourite->quantity; ?>" size="3" />
    		<input type="hidden" name="wpsc_action" value="update" />
    		<input type="hidden" name="wpsc_id" value="<?php echo $favourite->id; ?>" />
    		<td><?php echo wpsc_add_to_cart_button($favourite->product_id); ?></td>
    		</form>
    #6458
    jessemarple
    Participant

    Thanks ozoneboy! For clarification, ozone is suggesting you edit user-wishlist.php somewhere around 67.

    #6459
    jessemarple
    Participant

    ozoneboy,

    How did you fix the page refresh that occurs (thus removing my particular wishlist that I’m viewing) when I add to cart from the guest wishlist view?

    #6460
    ozoneboy
    Participant

    Hi jessemarple,
    When you say “guest wishlist view” do you mean you’re not logged in? My wishlist links only appear if you’re logged into your account and I haven’t had any problems with refresh. I’ve included the full “table” code below in case that helps (note that I’ve renamed my wishlist as “Favourites” and replaced the remove text with a “X” graphic/button)

    <h2>Your Favourite Products</h2>
    
    <form action="<?php echo $wishlist_url; ?>" method="POST">
    	<table class="logdisplay">
    		<tr class="toprow">
    			<td style="width:52px;">&nbsp;</td>
    			<td>Product</td>
    			<td>Quantity</td>
    			<td>Add to Cart</td>
    			<td>Remove</td>
    <?php
    if( !$guest ) { ?>
    			<td>&nbsp;</td>
    <?php
    } ?>
    		</tr>
    <?php
    		foreach( $favourites_data as $favourite ) {
    			$favourite_name_sql = "SELECT <code>name</code> FROM <code>wp_wpsc_product_list</code> WHERE <code>id</code> = '".$favourite->product_id."'";
    			$favourite->name = $wpdb->get_var( $wpdb->prepare( $favourite_name_sql ) ); ?>
    		<tr class="product_row alt">
    			<td class="firstcol">
    <?php if( $guest && $favourite->quantity == '0' ) { ?>
    				<img src='<?php echo vl_wpscat_item_image($favourite->product_id,48,48); ?>' alt='<?php echo $favourite->name; ?>' title='<?php echo $favourite->name; ?>' />
    <?php } else { ?>
    				<a href="<?php echo wpsc_product_url( $favourite->product_id ); ?>">
    					<img src='<?php echo vl_wpscat_item_image($favourite->product_id,48,48); ?>' alt='<?php echo $favourite->name; ?>' title='<?php echo $favourite->name; ?>' />
    				</a>
    <?php } ?>
    			</td>
    			<td>
    <?php if( $guest && $favourite->quantity == '0' ) { ?>
    				<?php echo $favourite->name; ?>
    <?php } else { ?>
    				<a href="<?php echo wpsc_product_url( $favourite->product_id ); ?>"><?php echo $favourite->name; ?></a>
    <?php } ?>
    			</td>
    <?php if( $guest ) { ?>
    			<td>
    				<?php if( $favourite->quantity == '0' ) { echo '-'; } else { echo $favourite->quantity; } ?>
    			</td>
    <?php } else { ?>
    			<td nowrap>
    				<form action="<?php echo $wishlist_url; ?>" method="POST">
    					<input type="text" name="quantity" value="<?php echo $favourite->quantity; ?>" size="3" />
    					<input type="hidden" name="wpsc_action" value="update" />
    					<input type="hidden" name="wpsc_id" value="<?php echo $favourite->id; ?>" />
    					<td><?php echo wpsc_add_to_cart_button($favourite->product_id); ?>	</td>
    				</form>
    			</td>
    
    			<td>
    			</td>
    
    			<td>
    				<form action="<?php echo $wishlist_url; ?>" method="POST">
    					<input type="submit" value="x" class="button sendbutton" />
    					<input type="hidden" name="wpsc_action" value="delete" />
    					<input type="hidden" name="wpsc_id" value="<?php echo $favourite->id; ?>" />
    				</form>
    			</td>
    <?php
    			} ?>
    		</tr>
    <?php
    		} ?>
    	</table>
    #6461
    Michael Visser
    Keymaster

    Hi guys, I’ll be adding an Add to Cart in the next Plugin update. I’m now focussed 100% on Plugins since working with Instinct on the upcoming 3.8 release; a beta will be announced in the coming week/s. 🙂

    #6462
    Michael Visser
    Keymaster

    Added in 1.5.5, download it now 🙂

Viewing 7 posts - 1 through 7 (of 7 total)
  • The topic ‘[Resolved] Can you add to cart from wishlist?’ is closed to new replies.