Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Recommended Posts

Hello,

 

I'm developing extensions to gburton/Responsive-osCommerce (thanks @@burt) and I want to extend the order class interface with, but I don't know how. Any tip about it?

  • Modifying core order.php This is what I avoid to do.
  • Modifying all ocurrences of require(DIR_WS_CLASSES . 'order.php') to require(DIR_MY_CLASSES . 'order.php') in 13 files... is there any way less intrusive?

 

Thanks a lot!

Link to comment
Share on other sites

@@katapofatico,

 

You can check this example for a chopping_cart extension:

http://www.oscommerce.com/forums/topic/408481-sppc-lite/?p=1734997

 

 

and if you download the following add-on you can find a more simple example for a currency extension:

http://addons.oscommerce.com/info/9365

 

the class extension is included and called in the store module: includes/modules/store/st_tax_below_price.php

$currencies = new currencies_mod();

and the extension class at the end:

if (class_exists('currencies')) {
class currencies_mod extends currencies {
    // add tax below price mod
    public function format($number, $calculate_currency_value = true, $currency_type = '', $currency_value = '', $products_tax = '', $show_tax_info = true) {
......................

hope this helps

 

regards

Rainer

Link to comment
Share on other sites

Thanks a lot for you quick answer,@@raiwa :thumbsup:

 

I had seen your currencies.php customization, but these case it's too much simple comparing with order.php: It works well because you have to replace the global instance in $currencies. Consider if you have to to the same on admin, where there are requires and instances creations after require application_top.php, for example in orders.php:

require('includes/application_top.php');

require(DIR_WS_CLASSES . 'currencies.php');
$currencies = new currencies();

This is my case... more similar to your shoppingCartMod class. Your example leads me to modify 13 core files with order class instantiation:

require(DIR_WS_CLASSES . 'order.php');
$order = new order;

// my customization start
require(DIR_MY_CLASSES . 'MyOrder.php');
$order = new MyOrder();
// my customization end

I was looking for a less intrusive way, but perhaps there is not any other... :( If you have any comments I'll be grateful. In any case, thanks for guide me to the best code!

 

Disculpa mi inglés :)

Link to comment
Share on other sites

 

 

[...]

require(DIR_WS_CLASSES . 'order.php');
$order = new order;

// my customization start
require(DIR_MY_CLASSES . 'MyOrder.php');
$order = new MyOrder();
// my customization end

[...]

 

Update:

 

My code above was inspired on @@raiwa your shoppingCartMod class, that manages a global variable $cart. In order class insntances case, it's better (more versatile) to pass the original $order as constructor parameter:

require(DIR_WS_CLASSES . 'order.php');
$order = new order;

// my customization start
require(DIR_MY_CLASSES . 'MyOrder.php');
$order = new MyOrder($order);
// my customization end
Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...