Skip to main content

how to pass data to a different url

10 years 3 months ago #246614 by ronron
-- 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.

10 years 3 months ago - 10 years 3 months ago #246672 by nicolas
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:
Code:
<?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: 10 years 3 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.

10 years 3 months ago - 10 years 3 months ago #246717 by ronron
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: 10 years 3 months ago by ronron.

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

10 years 3 months ago #246757 by ronron
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.

10 years 3 months ago #246764 by nicolas
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.

10 years 3 months ago - 10 years 3 months ago #246788 by ronron
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.
Code:
<?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.
Code:
<?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: 10 years 3 months ago by ronron.

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

10 years 3 months ago #246814 by nicolas
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.

10 years 3 months ago #246840 by ronron
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.

10 years 3 months ago #246846 by Jerome
Hi,

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

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

10 years 3 months ago #246910 by ronron
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.

10 years 3 months ago #246912 by Jerome
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.

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

Time to create page: 0.085 seconds
Powered by Kunena Forum