how to pass data to a different url

  • Posts: 490
  • Thank you received: 2
7 years 9 months ago #246614

-- HikaShop version -- : 2.6.3
-- Joomla version -- : 3.4.3
-- PHP version -- : 5.5
-- Error-message(debug-mod must be tuned on) -- : none

hi

(i dont know where to post this so i made one for hikashop)

i have been trying to integrate uddeim with hikashop.

my problem is that i cant get the right code to get the `tablename_users`.`id` and not the `tablename_hikamarket_vendor`.`vendor_id` for the (url)query string.

url query string example:

ndex.php?option=com_uddeim&task=new&recip=userid

can you please help me get the userid from product / show_default.php and listing_img_desc.php?

thanks

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

  • Posts: 81677
  • Thank you received: 13102
  • MODERATOR
7 years 9 months ago #246672

Hi,

So fro what I understand you want to know the Joomla user id of the vendor of the current product ?
In that case, you want to do something like that:

<?php
$vendorClass = hikamarket::get('class.vendor');
$vendor = $vendorClass->get($this->row->product_vendor_id,'vendor'); // or $vendorClass->get($this->element->product_vendor_id,'vendor'); for the product page
$userClass = hikashop_get('class.user');
$user = $userClass->get($vendor->vendor_admin_id);
echo $user->user_cms_id;
?>

Last edit: 7 years 9 months ago by Jerome. Reason: code fix
The following user(s) said Thank You: Jerome

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

  • Posts: 490
  • Thank you received: 2
7 years 9 months ago #246717

thank you nicolas.

You are right! i want to add a button to the product page that will get the joomla user id of the vendor.

example

<a class="btn btn-primary" href="/index.php?option=com_uddeim&task=new&recip={user_cms_id)" role="button">Inquire About This Product</a>.

user_cms_id = this shout be the cms or joomla user id.

thanks again.

Last edit: 7 years 9 months ago by ronron.

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

  • Posts: 490
  • Thank you received: 2
7 years 9 months ago #246757

hi nicolas,

i'have tried to check the results of the code and see if it will produce the user id but i was not successful.
am i doing it right?

tested show_default.php
1. <?php
$userClass = hikashop_get('class.user');
$user = $userClass->get($vendor->vendor_admin_id);
echo "<a href='$user->user_cms_id'>test</a>";
?>
when clicked redirect to http://home/store/product/1-pink-sandals

2. <a href="<?php $userClass = hikashop_get('class.user');
$user = $userClass->get($vendor->vendor_admin_id); echo $user->user_cms_id;?>"> Link </a>
when clicked redirect to home page

HikaMarket - vendormarket / showcontainer_default.php both are errors
1.
<?php
$vendorClass = hikamarket_get('class.vendor');
$vendor = $vendorClass->get($this->row->product_vendor_id,'vendor');
echo "<a href='$vendor'>test</a>";
?>
2.
<?php
$vendorClass = hikamarket_get('class.vendor');
$vendor = $vendorClass->get($this->element->product_vendor_id,'vendor');
echo "<a href='$vendor'>test</a>";
?>

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

  • Posts: 81677
  • Thank you received: 13102
  • MODERATOR
7 years 9 months ago #246764

Hi,

All your code is wrong.
For example, the code:
echo "<a href='$user->user_cms_id'>test</a>";
should be:
echo '<a href="/index.php?option=com_uddeim&task=new&recip='.$user->user_cms_id.'">test</a>';
because $user->user_cms_id will just give you the Joomla user id, not the whole uddeim link... and also because you're missing quotes, dots and double quotes, hence it's not valid HMTL/PHP.

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

  • Posts: 490
  • Thank you received: 2
7 years 9 months ago #246788

thanks nicolas for your patience.

I think i was not clear on my question. i was already successful with adding the joomla user id manually to my uddeim link. But it would be nice to get it using a button that will query the joomla user id.

My problem is how to get the joomla user id or user_cms_id from the product page and vendor page.

Everytime i execute the code you have given nothing happens. i used a different code using PHP inside html. i did not post it since you have given me a better one.

Now, to check if i am doing the code right i added the button to the code you have given me. i have posted this code below to check if it will echo the user id only and not to redirect to uddeim. But nothing happens.

<?php
$userClass = hikashop_get('class.user');
$user = $userClass->get($vendor->vendor_admin_id);
echo "<a href='$user->user_cms_id'>test</a>";
?>

Anyway, thanks again to your code but its still not working. i dont see a number or any user id next to the equal sign.
This is the code i used.
 <?php
      $userClass = hikashop_get('class.user');
      $user = $userClass->get($vendor->vendor_admin_id);
      echo '<a href="/index.php?option=com_uddeim&task=new&recip='.$user->user_cms_id.'">test</a>';
      ?>

The url below is the result. It is still empy
http://.../index.php?option=com_uddeim&task=new&recip=

Thanks again for you patience.

Last edit: 7 years 9 months ago by ronron.

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

  • Posts: 81677
  • Thank you received: 13102
  • MODERATOR
7 years 9 months ago #246814

Hi,

That code is not the problem.
The problem is what you added before.
Because there is no $vendor variable in the views of HikaShop. So I suppose that you must have added some other code to fill the $vendor variable.
Otherwise, In the code I gave here www.hikashop.com/forum/customers/885808-...rent-url.html#246672 I provided the code to load the $vendor but you didn't mention it in your past messages.

The following user(s) said Thank You: ronron

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

  • Posts: 490
  • Thank you received: 2
7 years 9 months ago #246840

thanks again

i tested the codes below but both of them failed to load. I tried to substitute the one with the comment

<?php
$vendorClass = hikamarket_get('class.vendor');
$vendor = $vendorClass->get($this->row->product_vendor_id,'vendor');
$userClass = hikashop_get('class.user');
$user = $userClass->get($vendor->vendor_admin_id);
echo '<a href="/index.php?option=com_uddeim&task=new&recip='.$user->user_cms_id.'">test</a>';
?>

and

<?php
$vendorClass = hikamarket_get('class.vendor');
$vendor = $vendorClass->get($this->element->product_vendor_id,'vendor');
$userClass = hikashop_get('class.user');
$user = $userClass->get($vendor->vendor_admin_id);
echo '<a href="/index.php?option=com_uddeim&task=new&recip='.$user->user_cms_id.'">test</a>';
?>



this is the error. Enabled debug

Fatal error: Call to undefined function hikamarket_get() in /home/mayari79/public_html/templates/purity_iii/html/com_hikashop/product/show_default.php on line 206

thanks so much

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

  • Posts: 26032
  • Thank you received: 4006
  • MODERATOR
7 years 9 months ago #246846

Hi,

Please replace

hikamarket_get
By
hikamarket::get
to make the code work properly.
I fixed the Nicolas' code in the previous post.

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.
The following user(s) said Thank You: ronron

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

  • Posts: 490
  • Thank you received: 2
7 years 9 months ago #246910

Thanks jerome and thank you nick. Works Perfectly

1. Both $vendor = $vendorClass->get($this->row->product_vendor_id,'vendor'); and $vendorClass->get($this->element->product_vendor_id,'vendor'); are working which one should i use?

2. Can you please give me the code how to get the product title or hikashop_product_name_main and the equivalent photo, I will try to prefill my form with the title and photo.

thanks again

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

  • Posts: 26032
  • Thank you received: 4006
  • MODERATOR
7 years 9 months ago #246912

Hi,

Depending the context you will have one or the other :
"element" is for the product page.
"row" is for the product listing.

It is possible that you also have "row" in the product page context ; but it's could not be always the case.

To retrieve product data, you need to get that data from "$this->element" or "$this->row".

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.

Time to create page: 0.069 seconds
Powered by Kunena Forum