Wedding Lists

  • Posts: 11
  • Thank you received: 0
11 years 7 months ago #96396

What I want to do is a page with wishlists (sort of) filtered by date + name, this could probably be saved on the cat_name field.
When a user orders any of the products on the list, it has to be marked as ordered or not show up at all.

Please Log in or Create an account to join the conversation.

  • Posts: 13201
  • Thank you received: 2322
11 years 7 months ago #96452

Hi,

You can use the Wishlist feature. To activate it, you have to go in Configuration > Features > Wishlist.
Then many menus can be created to display the current wishlist, display the wishlists listing, you can set a wishlist module.
And they can be shared, when a user buy an item from this wishlist, it's written in the wishlist.

Please Log in or Create an account to join the conversation.

  • Posts: 11
  • Thank you received: 0
11 years 7 months ago #96539

Thanks for the quick reply,

I have activated wishlists, but I haven't been able to get them to update after the users order the items,
or to have other users access the list through cart name instead of url.

Update: I have been looking into the code in Views->showcart.php and it seems it is actually updating the orders, but it is only showing a tooltip that isn't very noticeable for the users. But with a bit of php and css editing I should be able to use a line-through on name+price and disable the add to cart option.

Only missing the cart name filter isntead of the url one now.

Last edit: 11 years 7 months ago by nkrck. Reason: update

Please Log in or Create an account to join the conversation.

  • Posts: 11
  • Thank you received: 0
11 years 7 months ago #96562

Is there a way to make the items in the wishlist not group up by quantity, so that the quantity is always 1?

Please Log in or Create an account to join the conversation.

  • Posts: 13201
  • Thank you received: 2322
11 years 7 months ago #96625

Hi,

I don't recommend that, because in database the stock is for one product, if you display as many instance of the product as quantity for the product, then you can't really manage the stock.
If a user bought one item, the system will not know on which instance remove the stock.

The following user(s) said Thank You: nkrck

Please Log in or Create an account to join the conversation.

  • Posts: 11
  • Thank you received: 0
11 years 6 months ago #99221

Hi,
I managed to make a dropbox with the maximum option being the quantity of the item still left to buy in the wishlist
I also finished the wishlist filter (by name) page.

What code would I need to add the "Convert Cart To Wishlist" button to a new page (an article page), outside the checkout?

Please Log in or Create an account to join the conversation.

  • Posts: 13201
  • Thank you received: 2322
11 years 6 months ago #99288

Hi,

The code needed is:

$config = hikashop_config();
$cart = hikashop_get('helper.cart');
$params = $config->get('default_params');
global $Itemid;
$url_itemid = '&Itemid='.$Itemid;
$cartClass = hikashop_get('class.cart');
$cart = $cartClass->initCart();

$params->set('cart_type','wishlist');
echo $cart->displayButton(JText::_('CART_TO_WISHLIST'),'wishlist',$params,hikashop_completeLink('cart&task=convert&cart_type=cart&cart_id='.$cart->cart_id.$url_itemid),'window.location.href = \''.hikashop_completeLink('cart&task=convert&cart_type=cart&cart_id='.$cart->cart_id.$url_itemid).'\';return false;');

Please Log in or Create an account to join the conversation.

  • Posts: 11
  • Thank you received: 0
11 years 6 months ago #99428

I'm getting this error "Fatal error: Call to a member function set() on a non-object"
in the line

$params->set('cart_type','wishlist');


I only added this at the start of the code
if(!@include_once(rtrim(JPATH_ADMINISTRATOR,DS).DS.'components'.DS.'com_hikashop'.DS.'helpers'.DS.'helper.php')){ return false; }

Please Log in or Create an account to join the conversation.

  • Posts: 13201
  • Thank you received: 2322
11 years 6 months ago #99696

Thanks to try with:
$params ='';
$params = new HikaParameter($params);

instead of:
$params = $config->get('default_params');

The following user(s) said Thank You: nkrck

Please Log in or Create an account to join the conversation.

  • Posts: 11
  • Thank you received: 0
11 years 6 months ago #99757

Thanks that solved the previous error.
Now I just have one more in last line :(

Fatal error: Call to undefined method stdClass::displayButton()

Please Log in or Create an account to join the conversation.

  • Posts: 13201
  • Thank you received: 2322
11 years 6 months ago #99883

Sorry, you can try that:

$config = hikashop_config();
$cartHelper= hikashop_get('helper.cart');
$params ='';
$params = new HikaParameter($params);
global $Itemid;
$url_itemid = '&Itemid='.$Itemid;
$cartClass = hikashop_get('class.cart');
$cart = $cartClass->initCart();
 
$params->set('cart_type','wishlist');
echo $cartHelper->displayButton(JText::_('CART_TO_WISHLIST'),'wishlist',$params,hikashop_completeLink('cart&task=convert&cart_type=cart&cart_id='.$cart->cart_id.$url_itemid),'window.location.href = \''.hikashop_completeLink('cart&task=convert&cart_type=cart&cart_id='.$cart->cart_id.$url_itemid).'\';return false;');

The following user(s) said Thank You: nkrck

Please Log in or Create an account to join the conversation.

  • Posts: 11
  • Thank you received: 0
11 years 6 months ago #99987

Thank you :) that makes the page show up without errors,
but the cart_id seems to be incorrect, its not converting my current cart, its just sending me to the wishlist showcarts page, it seems the cart_id is from a newly created cart.

Please Log in or Create an account to join the conversation.

  • Posts: 11
  • Thank you received: 0
11 years 6 months ago #100003

I managed to get the correct cart_id with this, I added the If there because it doesn't make sense to let the user convert empty carts.
It seems to be working so far but if anything is wrong or missing please correct it :)
You can change the thread title if you want (since it doesn't mention convert button), I think this might be useful for others too.

Thanks again.

if(!@include_once(rtrim(JPATH_ADMINISTRATOR,DS).DS.'components'.DS.'com_hikashop'.DS.'helpers'.DS.'helper.php')){ return false; }

$config = hikashop_config();
$cartHelper= hikashop_get('helper.cart');
$params ='';
$params = new HikaParameter($params);
global $Itemid;
$url_itemid = '&Itemid='.$Itemid;
$cartClass = hikashop_get('class.cart');
if($cartClass->get()){
	$cart = $cartClass->loadCart();
	$params->set('cart_type','wishlist');
	echo $cartHelper->displayButton(JText::_('CART_TO_WISHLIST'),'wishlist',$params,hikashop_completeLink('cart&task=convert&cart_type=cart&cart_id='.$cart->cart_id.$url_itemid),'window.location.href = \''.hikashop_completeLink('cart&task=convert&cart_type=cart&cart_id='.$cart->cart_id.$url_itemid).'\';return false;');
}
else {echo "Please add products to your cart before trying to convert."}

edit: gonna leave here the rest of the code in case someone also wants to filter wishlists by name without users having to send urls to each others
note: this does not take into account the share options of the wishlist, tho that can be added, in this specific case I wanted users to chase the least amount of options possible
<?php
if(isset($_POST["cart_name"])) {
        JRequest::checkToken() or die( JText::_( 'Invalid Token' ) );
        $cart_name = JRequest::getCmd( 'cart_name', '', 'POST' );
	if($cart_name != "") {
	$db = JFactory::getDBO();             
	$query = 'SELECT cart_id FROM jos_hikashop_cart WHERE cart_name = '. $db->quote($cart_name).' ';             
	$db->setQuery($query);             
	$result = $db->loadResult();
		if($result !== null) {
			$url ="index.php?option=com_hikashop&ctrl=cart&task=showcart&cart_id=".$result."&cart_type=wishlist";
			header( "Location: $url" );
		}
		else {JError::raiseNotice( 100, 'No wishlist was found' );}
	}
	else {JError::raiseNotice( 100, 'Please fill the wishlist name field"' );}
}
?>

<form id="idWeddinglistform" name="weddinglistForm" method="post" action="">
	<label>
		Wishlist name:
		<span> *</span>
	</label>

	<input type="text" name="cart_name">

	<button type="submit">Search</button>
	<?php echo JHTML::_( 'form.token' ); ?>
</form>
I used both of these with a flexi module.

Last edit: 11 years 6 months ago by nkrck.

Please Log in or Create an account to join the conversation.

  • Posts: 11
  • Thank you received: 0
11 years 6 months ago #100162

It still has a small error, I have a login module and a cart module on that same page.
And when I login into a user account that already had something in its cart, the cart shows empty and the cart_id for the button is 0.
If I change to other pages the cart module displays correctly but it still doesn't have anythign when I change back to that page until I remove the products in that cart, and add new ones, then it displays correctly.

Please Log in or Create an account to join the conversation.

  • Posts: 13201
  • Thank you received: 2322
11 years 6 months ago #100230

Hi,

In the given core, can you try with: $cart = $cartClass->loadCart();
instead of: $cart = $cartClass->initCart();

Please Log in or Create an account to join the conversation.

Time to create page: 0.102 seconds
Powered by Kunena Forum