Ad Button To Ventdor Panel for link+username ??

  • Posts: 132
  • Thank you received: 3
  • Hikaserial Subscription Hikashop Business
10 years 3 months ago #167929

How to add image to a Vendor Panel and link that image to Vendors directory/ category?

Every vendor user name became his directory. Like

When Mikle Smith registered on the joomla he automatically gets his own directory to store his product inside
mywebsite.com/by/ directory in his folder named after his username Mikle-Smith:

mywebsite.com/by/Mikle%20Smith
or
mywebsite.com/by/Mikle-Smith

So , I guess it is probably possible to add new image in the Vendor Panel that let that vendor see his own store directory.

The link from the image should be: mywebsite.com/by + USER NAME

Question:
1) How to create that link code, or a complete code with image linked to that url
2) Where to place that code to add it to Vendor's Panel and
3) On what line to ad that code please?

Attachments:

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

  • Posts: 26156
  • Thank you received: 4028
  • MODERATOR
10 years 3 months ago #167997

Hi,

You can do it thanks a view override (or a custom plugin).
By overriding the view "frontend | your_frontend_template | vendormarket | cpanel" you can modify the content of the variable "$this->buttons".
The idea is to add a new button in the array.

		<h2><?php echo $this->vendor->vendor_name; ?></h2>
<?php
//---- Begin a sample code ----
$this->buttons['my_store'] = array(
	'url' => hikamarket::completeLink('vendor&task=show&cid='.$this->vendor->vendor_id);
	'icon' => 'icon48-mystore',
	'name' => JText::_('MY_STORE')
);
//---- End of sample code ----
foreach($this->buttons as $btnName => $btn) {
	if(empty($btn))
		continue;

The other way is to use the trigger
onVendorPanelDisplay(&$buttons, &$statistics);
Which allowed you to access and modify the $buttons array, like in the view (but without having to override the cpanel view).
Sample here : www.hikashop.com/support/documentation/1...onVendorPanelDisplay

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: 132
  • Thank you received: 3
  • Hikaserial Subscription Hikashop Business
10 years 3 months ago #168055

Could yo please specify more precise how should I use example line

'url' => hikamarket::completeLink('vendor&task=show&cid='.$this->vendor->vendor_id);

for my url:
mywebsite.com/by
- should it be

' mywebsite.com/by/ ' => hikamarket::completeLink('vendor&task=show&cid='.$this->vendor->vendor_id);

or it should be
'url' => hikamarket::http://mywebsite.com/by/('vendor&task=show&cid='.$this->vendor->vendor_id);

From your example:

//---- Begin a sample code ----
$this->buttons = array(
'url' => hikamarket::completeLink('vendor&task=show&cid='.$this->vendor->vendor_id);
'icon' => 'icon48-mystore',
'name' => JText::_('MY_STORE')
);
//---- End of sample code ----

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

  • Posts: 26156
  • Thank you received: 4028
  • MODERATOR
10 years 3 months ago #168057

Hi,

None of them.

"completeLink" is a function which generate you a link (a complete link, with SEF, etc).
If you want to have a nice SEF link, you have to use an "Itemid" and a specific menu (a vendor listing menu is better).
Like :

$this->buttons = array(
   'url' => hikamarket::completeLink('vendor&task=show&cid='.$this->vendor->vendor_id.'&Itemid=42');
   'icon' => 'icon48-mystore',
   'name' => JText::_('MY_STORE')
);

If HikaShop and HikaMarket are configured to generate SEF and "Remove products and categories id in URLs", you will have a nice SEF url with the name of the vendor.
See : www.hikashop.com/support/support/documen...ig.html#features_sef

Menu edition (work the same in HikaMarket) : www.hikashop.com/support/documentation/i...shop-menus-form.html

More than providing an URL, you have to be sure that the url is working and will display a good content ; that is one of the goals of the function "completeLink".
The code I gave in my previous post is a working code, that you can use directly ; the rest is just to configuration/adjustments.

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: 132
  • Thank you received: 3
  • Hikaserial Subscription Hikashop Business
10 years 3 months ago #168466

Thank you Jerome. Thank you for the detailed example.
I added MY STORE icon on the Vendor Page and it works according to your detailed recommendation.
Thank you.

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

  • Posts: 132
  • Thank you received: 3
  • Hikaserial Subscription Hikashop Business
10 years 1 month ago #174905

Ok,

Last edit: 10 years 1 month ago by alexmartin.

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

  • Posts: 26156
  • Thank you received: 4028
  • MODERATOR
10 years 1 month ago #174933

Hi,

I am sorry but I don't understand your message.
I don't know what button you are talking about, what you are trying to achieve and what is the article.

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: 132
  • Thank you received: 3
  • Hikaserial Subscription Hikashop Business
10 years 1 month ago #175001

How each vendor gets on to his own directory page

Last edit: 10 years 1 month ago by alexmartin.

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

  • Posts: 26156
  • Thank you received: 4028
  • MODERATOR
10 years 1 month ago #175004

Hi,

The url type is : index.php?option=com_hikamarket&view=vendor&layout=show&cid=VENDOR_ID&name=VENDOR_NAME
The "name" is optional but it allow to have nice url using the Joomla SEF router.

Otherwise, HikaMarket have some functions to get the vendor_id from another id (like the Joomla user id).
You first need to load the HikaMarket helper and then call the HikaMarket vendor class.
Here a complete code to generate a full and SEF url (with right menu id, etc)

$joomla_user_id = 0; /* This variable must contain the joomla user id */

// We load HikaMarket is not
if(!defined('HIKAMARKET_COMPONENT')) {
	$filename = rtrim(JPATH_ADMINISTRATOR,DS).DS.'components'.DS.'com_hikamarket'.DS.'helpers'.DS.'helper.php';
	if(file_exists($filename)) include_once($filename);
}

$vendor_url = ''; /* This variable will contain the link to the vendor page if the vendor exist and his published */

// We check that HikaMarket is right loaded
if(defined('HIKAMARKET_COMPONENT')) {
	// We load the vendor based on the joomla user id
	$vendorClass = hikamarket::get('class.vendor');
	$vendor = $vendorClass->get($joomla_user_id, 'cms');

	// We check that the vendor exist and is published
	if(!empty($vendor) && !empty($vendor->vendor_published)) {
		$app = JFactory::getApplication();
		$marketConfig = hikamarket::config();
		$stringSafe = (method_exists($app, 'stringURLSafe'));

		// Get the vendor alias to have a nice url
		$vendor->alias = (empty($vendor->vendor_alias)) ? $vendor->vendor_name : $vendor->vendor_alias;
		if($stringSafe) $vendor->alias = $app->stringURLSafe(strip_tags($vendor->alias));
		else $vendor->alias = JFilterOutput::stringURLSafe(strip_tags($vendor->alias));

		// Get the HikaMarket default menu, to have a nice SEF url
		$url_itemid = $marketConfig->get('vendor_default_menu', 0);
		if(!empty($url_itemid)) $url_itemid = '&Itemid=' . (int)$url_itemid;
		else $url_itemid = '';

		// Generate the url
		$vendor_url = hikamarket::completeLink('vendor&task=show&cid=' . $vendor->vendor_id . '&name=' . $vendor->alias . $url_itemid);
	}
}
It will see to add a function in the HikaMarket helper in order to generate these url easily.

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.

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