JTable::getInstance in Joomla 4

01.03.2023 16:35
#1
ePole
Joomshopping forum user no avatar
Name: Jack
01.03.2023
Posts: 8
Quote
JTable::getInstance in Joomla 4

Hallo,

ich versuche folgenden Code in der aktuellen Modulversion in Joomla 4 im Checkout Controller auszuführen und bekomme Fehler, hat sich in Joomla 4 da grundlegend was geändert?

Wie würde das in Joomla 4 aussehen?

Joomla 3
##########################################
$order = JTable::getInstance('order', 'jshop');
$order->load($order_id);
$view->assign('order_number', $order->order_number);

$cart = JModelLegacy::getInstance('cart', 'jshop');
$cart->load();
##########################################

Gruß
Jack


Joomla: 4
 
01.03.2023 17:43
#2
admin
(Support Team)
User admin
Name: Admin
05.08.2010
Posts: 25965
Quote
Aw: JTable::getInstance in Joomla 4

$order = \JSFactory::getTable('order', 'jshop');
$order->load($order_id);
$view->set('order_number', $order->order_number);

$cart = \JSFactory::getModel('cart', 'jshop');
$cart->load();

 
02.03.2023 07:51
#3
ePole
Joomshopping forum user no avatar
Name: Jack
01.03.2023
Posts: 8
Quote
Aw: JTable::getInstance in Joomla 4

admin - 01.03.2023 17:43
$order = \JSFactory::getTable('order', 'jshop');
$order->load($order_id);
$view->set('order_number', $order->order_number);

$cart = \JSFactory::getModel('cart', 'jshop');
$cart->load();


THANK YOU SO MUCH !!!

 
02.03.2023 08:55
#4
ePole
Joomshopping forum user no avatar
Name: Jack
01.03.2023
Posts: 8
Quote
Aw: JTable::getInstance in Joomla 4

Ich konnte es soweit einbinden und erhalte keine Fehler mehr, vielen Dank.
Ich bekomme im Checkout (finish.tpl) allerdings immer noch keine Daten übergeben.

Das versuche ich mit folgendem Code:
$this->order_number;

Hat sich da auch etwas geändert oder haben sich die Datenbanktabellen auch geändert?
- order_number
- email
- order_total
- payment_method_id
- image_product_live_path

Gruß
Jack

 
02.03.2023 10:03
#5
admin
(Support Team)
User admin
Name: Admin
05.08.2010
Posts: 25965
Quote
Aw: JTable::getInstance in Joomla 4

There were no changes.

$this->order_number; - will not work (JoomShopping 4 or 5)

checkout / finish
data is not transmitted

 
02.03.2023 10:19
#6
ePole
Joomshopping forum user no avatar
Name: Jack
01.03.2023
Posts: 8
Quote
Aw: JTable::getInstance in Joomla 4

Thanks.

So how do I get the required data in the checkout (finish.tpl) ?

This i put in the:
/components/com_jshopping/Controller/CheckoutController.php

$my_order = \JSFactory::getTable('order', 'jshop');
$my_order->load($order_id);
$view->set('my_order_number', $my_order->order_number);
$view->set('my_email', $my_order->email);

And now how to grab this data in the finish.tpl on the checkout site?
/components/com_jshopping/templates/XXX/checkout/finish.php

Best,
Jack


Letzte Änderung: 02.03.2023 10:23
 
02.03.2023 10:25
#7
admin
(Support Team)
User admin
Name: Admin
05.08.2010
Posts: 25965
Quote
Aw: JTable::getInstance in Joomla 4

See (as example)
https://www.webdesigner-profi.de/joomla-webdesign/shop/plugins/checkout-finish.html

OR

https://www.webdesigner-profi.de/joomla-webdesign/shop/addons/google-conversion-tracking.html

Your get $order_id

public function onBeforeDisplayCheckoutFinish(&$text, &$order_id){
.....


Letzte Änderung: 02.03.2023 10:27
 
02.03.2023 10:37
#8
ePole
Joomshopping forum user no avatar
Name: Jack
01.03.2023
Posts: 8
Quote
Aw: JTable::getInstance in Joomla 4

Why should I use plugins? Is it no longer possible programmatically?

 
02.03.2023 11:32
#9
ePole
Joomshopping forum user no avatar
Name: Jack
01.03.2023
Posts: 8
Quote
Aw: JTable::getInstance in Joomla 4

admin - 02.03.2023 10:03
...
$this->order_number; - will not work (JoomShopping 4 or 5)

checkout / finish
data is not transmitted


And what will work in JoomShopping 4 or 5 ?

Best
Jack

 
02.03.2023 14:23
#10
ePole
Joomshopping forum user no avatar
Name: Jack
01.03.2023
Posts: 8
Quote
Aw: JTable::getInstance in Joomla 4

Last Question:

Is this still possible?

JUri::root(FALSE, $my_product['href']);

Best
Jack


Letzte Änderung: 02.03.2023 14:23
 
02.03.2023 15:35
#11
admin
(Support Team)
User admin
Name: Admin
05.08.2010
Posts: 25965
Quote
Aw: JTable::getInstance in Joomla 4

For JoomShopping use:

JSHelper::SEFLink('....');

 


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.