Use Address-information in a normal form aswell

28.07.2020 09:06
#1
Warren84
Joomshopping forum user no avatar
Name: Thomas
08.09.2015
Posts: 64
Quote
Use Address-information in a normal form aswell

Hi guys,

i'm planning to use a normal contact form on my website, using rsform.
rsform got the possibility to auto fill fields from database, for example like this:

//<code>
$user = JFactory::getUser();
return $user->get('email');
//</code>

Do you know, if - with this way - I could also auto insert date from joomshopping database? for example street, city and others? So that logged in user not have to fill out this data again?

 
28.07.2020 11:02
#2
admin
(Support Team)
User admin
Name: Admin
05.08.2010
Posts: 25941
Quote
Aw: Use Address-information in a normal form aswell

$user = JSFactory::getUser();

 
28.07.2020 11:06
#3
Warren84
Joomshopping forum user no avatar
Name: Thomas
08.09.2015
Posts: 64
Quote
Aw: Use Address-information in a normal form aswell

Thanks!

Is there a list of the db fields for address, city, zip, salutation, etc?

 
28.07.2020 13:32
#4
admin
(Support Team)
User admin
Name: Admin
05.08.2010
Posts: 25941
Quote
Aw: Use Address-information in a normal form aswell

Yes.

 
04.03.2023 12:01
#5
vega55
Joomshopping forum user no avatar
Name: Vega Arda
07.12.2022
Posts: 31
Quote
Aw: Use Address-information in a normal form aswell

How can I get the product code using the code above? to the product code part of the rsform

 
04.03.2023 12:29
#6
admin
(Support Team)
User admin
Name: Admin
05.08.2010
Posts: 25941
Quote
Aw: Use Address-information in a normal form aswell

I do not understand the question?

Do you have a product_id?

 
04.03.2023 12:43
#7
vega55
Joomshopping forum user no avatar
Name: Vega Arda
07.12.2022
Posts: 31
Quote
Aw: Use Address-information in a normal form aswell

I placed rsform Order Form on my product page
However, I want to automatically place the product code on my product page in the product code section in the order form.


Last change: 04.03.2023 12:49
 
04.03.2023 12:53
#8
admin
(Support Team)
User admin
Name: Admin
05.08.2010
Posts: 25941
Quote
Aw: Use Address-information in a normal form aswell

$product_id = \JFactory::getApplication()->input->getInt('product_id');

$product = \JSFactory::getTable('product');
$product->load($product_id);

$code = $product->getEan();

 
04.03.2023 13:08
#9
vega55
Joomshopping forum user no avatar
Name: Vega Arda
07.12.2022
Posts: 31
Quote
Aw: Use Address-information in a normal form aswell

I added the code, unfortunately it didn't work
input part of the form is empty

//<code>
$product_id = \JFactory::getApplication()->input->getInt('product_id');

$product = \JSFactory::getTable('product');
$product->load($product_id);

$code = $product->getEan();
//</code>

 
04.03.2023 14:03
#10
vega55
Joomshopping forum user no avatar
Name: Vega Arda
07.12.2022
Posts: 31
Quote
Aw: Use Address-information in a normal form aswell

so when I use the above code, it gives the following error on my product page
0
Class 'JSFactory' not found

 
04.03.2023 14:37
#11
admin
(Support Team)
User admin
Name: Admin
05.08.2010
Posts: 25941
Quote
Aw: Use Address-information in a normal form aswell

JoomShopping version?

for JoomShopping 5
Add
require_once (JPATH_SITE.'/components/com_jshopping/bootstrap.php');

-------------------------

 
04.03.2023 19:31
#12
vega55
Joomshopping forum user no avatar
Name: Vega Arda
07.12.2022
Posts: 31
Quote
Aw: Use Address-information in a normal form aswell

Thanks for your help Admin
but when I use the code it doesn't write the product code
The field to write the product code remains empty.

To try, I wrote the code that shows the user mail below in the product code section.
mail is automatically typed into the product code input of the form

//<code>
$user = JSFactory::getUser();
return $user->get('email');
//</code>


//<code>
require_once (JPATH_SITE.'/components/com_jshopping/bootstrap.php');
$product_id = \JFactory::getApplication()->input->getInt('product_id');

$product = \JSFactory::getTable('product');
$product->load($product_id);

$code = $product->getEan();
//</code>


Last change: 04.03.2023 19:31
 
04.03.2023 22:56
#13
admin
(Support Team)
User admin
Name: Admin
05.08.2010
Posts: 25941
Quote
Aw: Use Address-information in a normal form aswell

The code on the product page works.
-------------------------------------------------
I don't know how and where you use it.

 
04.03.2023 23:50
#14
vega55
Joomshopping forum user no avatar
Name: Vega Arda
07.12.2022
Posts: 31
Quote
Aw: Use Address-information in a normal form aswell

product code not working
I only use the form on my product page

I add the codes you wrote to the default value section in the product code section of the form, I save it as in the images.
then I open the form on my product page
the result does not change

in the same way, when I use the user mail code shared above, I see it in the mail section of the form, that code works.


Aw: Use Address-information in a normal form aswell Aw: Use Address-information in a normal form aswell Aw: Use Address-information in a normal form aswell

 
05.03.2023 09:37
#15
admin
(Support Team)
User admin
Name: Admin
05.08.2010
Posts: 25941
Quote
Aw: Use Address-information in a normal form aswell

print $product_id = \JFactory::getApplication()->input->getInt('product_id');

works?

 
05.03.2023 10:02
#16
vega55
Joomshopping forum user no avatar
Name: Vega Arda
07.12.2022
Posts: 31
Quote
Aw: Use Address-information in a normal form aswell

If I use the code like this, the product code of the form is not in the input section, but the product id appears at the top of the page
//<code>
require_once (JPATH_SITE.'/components/com_jshopping/bootstrap.php');
print $product_id = \JFactory::getApplication()->input->getInt('product_id');
$product_id = JFactory::getApplication()->input->getInt('product_id');
$product = JSFactory::getTable('product');
$product->load($product_id);
$code = $product->getEan();
//</code>

-------------------------------------------------------
If the code is used in this way, the product code is not written inside the form or at the top of the page.

//<code>
require_once (JPATH_SITE.'/components/com_jshopping/bootstrap.php');
$product_id = \JFactory::getApplication()->input->getInt('product_id');

$product = \JSFactory::getTable('product');
$product->load($product_id);

$code = $product->getEan();
//</code>

--------------------------------------------------------------
if i use the code like this the product code is at the top of the page
Does not write product code in the product code part of the form

I wrote a script to write it in the form, it didn't work
[29]='product_code';formComponents

<script type="text/javascript">
var c1 = "<?php echo $code; ?>";
document.getElementById("product_code").value = c1;
</script>


//<code>
require_once (JPATH_SITE.'/components/com_jshopping/bootstrap.php');

$product_id = JFactory::getApplication()->input->getInt('product_id');
$product = JSFactory::getTable('product');
$product->load($product_id);

$code = $product->getEan();
echo $code;
//</code>

 
05.03.2023 10:55
#17
admin
(Support Team)
User admin
Name: Admin
05.08.2010
Posts: 25941
Quote
Aw: Use Address-information in a normal form aswell

maybe you need
...
return $code;

 
08.03.2023 12:03
#18
vega55
Joomshopping forum user no avatar
Name: Vega Arda
07.12.2022
Posts: 31
Quote
Aw: Use Address-information in a normal form aswell

Thanks admin return $code; it worked

 


Copyrights MAXXmarketing GmbH. Alle Rechte vorbehalten
Durch die Nutzung dieser Website stimme ich zu, dass Cookies zur optimalen Gestaltung der Website sowie zur Analyse der Nutzung der Website verwendet werden. Weiterführende Informationen finden Sie hier. OK, einverstanden.