Add vendor to favourite

  • Posts: 85
  • Thank you received: 9
4 years 7 months ago #319705

-- HikaShop version -- : 4.3.0
-- HikaMarket version -- : 3.1.0
-- Joomla version -- : 3.9.18
-- PHP version -- : 7.2.26

Hello,

is it possible to permit to the users registered to add the vendors to their favourites?


Thank you for your support

Last edit: 4 years 1 month ago by pagemaster.

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

  • Posts: 26166
  • Thank you received: 4029
  • MODERATOR
4 years 7 months ago #319738

Hello,

Can you please provide more details regarding your feature request.
Since there is no possibility to add product or categories to their favorites ; I admit that I don't understand what you're asking exactly.

Regards,


Jerome - Obsidev.com
HikaMarket & HikaSerial developer / HikaShop core dev team.

Also helping the HikaShop support team when having some time or couldn't sleep.
By the way, do not send me private message, use the "contact us" form instead.

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

  • Posts: 85
  • Thank you received: 9
4 years 7 months ago #319763

I mean if it`s possible with Hikmarket to add the vendor to the wish list like for the products. In attach you can see the wish list button (marked in red) of Hikashop for the products.

Thank you for the support

Attachments:
Last edit: 4 years 7 months ago by pagemaster.

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

  • Posts: 26166
  • Thank you received: 4029
  • MODERATOR
4 years 7 months ago #319820

Hello,

The wishlist is exactly like a cart, you can add product into, not vendors.
In the wishlist you can just add products, not categories or vendors ; that's why we really need to understand what is your feature request. For the moment I do have the feeling that it would be an important development, with new database tables, views, etc.

Regards,


Jerome - Obsidev.com
HikaMarket & HikaSerial developer / HikaShop core dev team.

Also helping the HikaShop support team when having some time or couldn't sleep.
By the way, do not send me private message, use the "contact us" form instead.

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

  • Posts: 85
  • Thank you received: 9
4 years 6 months ago #319885

ok, I try to implement this function with code

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

  • Posts: 85
  • Thank you received: 9
4 years 1 month ago #325468

I solved with custom code. I added a button in each category that hase the same name of the vendor.

This is the code of the view HikaShop - category / listing_img_title.php:

<?php

		// Get a db connection.
		$db = JFactory::getDbo();
		
		// Create a new query object.
		$query = $db->getQuery(true);
		
		$query->select('vendor_id');
		$query->from($db->quoteName('tbuonapp_hikamarket_vendor'));
		$query->where('vendor_name = ' . '"' . $this->row->category_name . '"');

		// Reset the query using our newly populated query object.
		$db->setQuery($query);
		$idVendor = $db->loadResult();
		
		
		// Get a db connection.
		$db = JFactory::getDbo();
		
		// Create a new query object.
		$query = $db->getQuery(true);
		
		$query->select('vendor_alias');
		$query->from($db->quoteName('tbuonapp_hikamarket_vendor'));
		$query->where('vendor_name = ' . '"' . $this->row->category_name . '"');

		// Reset the query using our newly populated query object.
		$db->setQuery($query);
		$aliasVendor = $db->loadResult();
		
	?>

<?php if($idVendor != null and $idVendor != ""){ ?>
		<br>
		
		<form method="post">
			<div>
				<?php 
					foreach ($users as $currentUser) {
						if($currentUser == $user->username) {
							$favourite = true;
						}elseif($favourite != true){
							$favourite = false;
						}
					}
				?>
				<?php if($favourite){ ?>
					
					<input class ='hikabtn hikawishlist' value="Togli dai preferiti" name="<?php echo 'removeFavourite' . $this->row->category_id; ?>" type="submit">
				
				<?php }else{ ?>
				
					<input class ='hikabtn hikawishlist' value="Aggiungi ai preferiti" name="<?php echo 'favourite' . $this->row->category_id; ?>" type="submit">
				
				<?php } ?>
			</div>
			
			<?php
				if(isset($_POST['removeFavourite' . $this->row->category_id])){
				
					for($i = 0; $i < count($users) - 1; $i++) {
						if($users[$i] != $user->username) {
							$stringUsernamesFavourites .= $users[$i] . ";";
						}
					}
					
				}elseif(isset($_POST['favourite' . $this->row->category_id])){
					$stringUsernamesFavourites = $usersFavourites . $user->username . ";";
				}
			
				if(isset($_POST['favourite' . $this->row->category_id]) or isset($_POST['removeFavourite' . $this->row->category_id])){
					
					// Get a db connection.
					$db = JFactory::getDbo();
					
					// Create a new query object.
					$query = $db->getQuery(true);
					
					// Campi da modificare
					$fields = array(
						$db->quoteName('utenti_preferiti') . ' = "' . $stringUsernamesFavourites . '"'
					);
					
					// Preparazione della query
					$query->update($db->quoteName('tbuonapp_hikashop_category'));
					$query->set($fields);
					$query->where('category_id = ' . '"' . $this->row->category_id . '"');
					
					// Impostazione ed esequzione della query precedentemente impostata
					$db->setQuery($query);
					$db->execute();
					
					header('Location: https://www.buonapp.ch/ristoranti');
				}
			?>
		</form>
	<?php } ?>

And after I created a view for the users where they can see the favourites

Last edit: 4 years 1 month ago by pagemaster.

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

Moderators: Obsidev
Time to create page: 0.070 seconds
Powered by Kunena Forum