Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Simple tracking module


bkiani

Recommended Posts

Hi

 

it seems that I have missed one edit.

 

Please go to catalog/admin/includes/boxes/localization.php

 

Find:

        'link' => tep_href_link(FILENAME_ORDERS_STATUS)

Add right after it:

		// tracking module
	  ),
      array(
        'code' => FILENAME_TRACKING,
        'title' => BOX_LOCALIZATION_TRACKING,
        'link' => tep_href_link(FILENAME_TRACKING)		

Let me know if it works, then I'll update the package

Link to comment
Share on other sites

Hello

Thank you for your answer  tarmogr

 

I have done all the installation steps new package
but view this error
 

1054 - Unknown column 'tracking_no' in 'field list'

select orders_status_id, date_added, customer_notified, comments, tracking_no, tracking_methods_id from orders_status_history where orders_id = '1567' order by date_added

 

thanks

Link to comment
Share on other sites

there is an error in step 2. I must have been in real hurry posting this contribution, anyway correct query is:

 

2. Insert this query into your oscommerce database (go to myphpadmin, select store database and click SQL tab, paste this into the field and click go)


CREATE TABLE IF NOT EXISTS `tracking_methods` (
  `tracking_methods_id` int(11) NOT NULL DEFAULT '0',
  `language_id` int(11) NOT NULL DEFAULT '1',
  `tracking_methods_name` varchar(32) COLLATE utf8_unicode_ci NOT NULL,
  `tracking_methods_url` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
  `mach` varchar(64) COLLATE utf8_unicode_ci NOT NULL,
  `icon` varchar(32) COLLATE utf8_unicode_ci NOT NULL,
  `autostatus` int(11) NOT NULL,
  PRIMARY KEY (`tracking_methods_id`,`language_id`),
  KEY `idx_tracking_methods_url` (`tracking_methods_url`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;



ALTER table `orders_status_history` ADD `tracking_no` VARCHAR(32) NOT NULL;
ALTER table `orders_status_history` ADD `tracking_methods_id` int(11) NOT NULL DEFAULT '0';

 

Yu may want to delete the tracking_methods table and new columns in order status history table before running this

Edited by burt
corrected sql
Link to comment
Share on other sites

there is an error in step 2. I must have been in real hurry posting this contribution, anyway correct query is:

 

2. Insert this query into your oscommerce database (go to myphpadmin, select store database and click SQL tab, paste this into the field and click go)

 

 

CREATE TABLE IF NOT EXISTS `tracking_methods` (

  `tracking_methods_id` int(11) NOT NULL DEFAULT '0',

  `language_id` int(11) NOT NULL DEFAULT '1',

  `tracking_methods_name` varchar(32) COLLATE utf8_unicode_ci NOT NULL,

  `tracking_methods_url` varchar(255) COLLATE utf8_unicode_ci NOT NULL,

  `mach` varchar(64) COLLATE utf8_unicode_ci NOT NULL,

  `icon` varchar(32) COLLATE utf8_unicode_ci NOT NULL,

  `autostatus` int(11) NOT NULL,

  PRIMARY KEY (`tracking_methods_id`,`language_id`),

  KEY `idx_tracking_methods_url` (`tracking_methods_url`)

) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

 

 

DROP TABLE IF EXISTS `zones`;

ALTER table `orders_status_history` ADD `tracking_no` VARCHAR(32) NOT NULL;

ALTER table `orders_status_history` ADD `tracking_methods_id` int(11) NOT NULL DEFAULT '0';

 

Yu may want to delete the tracking_methods table and new columns in order status history table before running this

The data has been cleared all zones

all zones delete !!!!!!

Edited by bkiani
Link to comment
Share on other sites

it seems that I have missed one edit.

 

 

 

 

there is an error in step 2. I must have been in real hurry posting this contribution, anyway correct query is:

 

 

 

sorry remove that zones part, it was left there accidentally

 

 

I'm sorry, but no

 

This type of "add ons", uploaded in a "hurry" as you say, with missing code parts and other code parts damaging peoples databases are exactly what should not be in the add ons area

 

People will spend hours trying to install this and end up with a broken store as @@bkiani just posted. Such a store, big or small, may me the way someone makes his living, this is not a game here

 

There is of course the users responsibility, to take a backup before doing anything or leave it at all if he has no idea, but, at the other hand, there is also the contributors responsibility, to make sure that what they upload is working correctly

 

You didn't test - enough - what you uploaded and you didn't check at all what you are posting here. What is now with OP's database? It's damaged because of your advise, given in a "hurry". Are you going to help him to restore?

Link to comment
Share on other sites

@@bkiani

 

Do you have a backup of your database? If so, restore it.

 

If not, try to remember if you created any "zones" in admin? In case you didn't, you can re-import a default zones table. 

Link to comment
Share on other sites

@@bkiani

 

Do you have a backup of your database? If so, restore it.

 

If not, try to remember if you created any "zones" in admin? In case you didn't, you can re-import a default zones table. 

 

I had a backup file

Information removed and restored

But this is a plugin problem

The plugin creates information that can not be removed

Tracking code not accept Posts

The code consists of 20 digit only

 

I wanted to get this plugin to Persian Translation

But it seems the problem is

 

thankyou

Edited by bkiani
Link to comment
Share on other sites

  • 1 month later...

@@tarmogr

 

Hi, I have installed your add-on and followed your instructions. The problem is that the tracking box does'nt show in the admin part. 

I have tried several ways to solve this problem but I don't get any result. 

 

I have tried to get your add-on to work in collaboration with an other add-on (Invoice editor). In the attached files you can find my admin/orders.php file. In this file the adaptions where the hardest because of the collaboration. 

 

Can you find a solution? 

 

Ben 

orders.php

Link to comment
Share on other sites

Hi Ben

 

One thing I noticed you had a mossing echo in the order history table "while loop"

   	while ($orders_history = tep_db_fetch_array($orders_history_query)) {
        echo '          <tr>' . "\n" .
             '            <td class="smallText" align="center">' . tep_datetime_short($orders_history['date_added']) . '</td>' . "\n" .
             '            <td class="smallText" align="center">';
        if ($orders_history['customer_notified'] == '1') {
          echo tep_image(DIR_WS_ICONS . 'tick.gif', ICON_TICK) . "</td>\n";
        } else {
          echo tep_image(DIR_WS_ICONS . 'cross.gif', ICON_CROSS) . "</td>\n";
        }
        echo '            <td class="smallText">' . $orders_status_array[$orders_history['orders_status_id']] . '</td>' . "\n" .
             '            <td class="smallText">' . nl2br(tep_db_output($orders_history['comments'])) . ' </td>' . "\n" .
             '            <td class="smallText" align="center">';
        if ($orders_history['invoice_sent'] == '1') {
          echo tep_image(DIR_WS_ICONS . 'tick.gif', ICON_TICK) . "</td>\n";
        } else {
          echo tep_image(DIR_WS_ICONS . 'cross.gif', ICON_CROSS) . "</td>\n";
          }
             //'          </tr>' . "\n";//

	    // tracking module start
			 '            <td class="smallText">';
			 if ($orders_history['tracking_no']!==''){
			 if (isset($tracking_names_array[$orders_history['tracking_methods_id']])){
			 $carrier= $tracking_names_array[$orders_history['tracking_methods_id']];
			 $button=  ' <a href="' . $tracking_methods_array[$orders_history['tracking_methods_id']] . $orders_history['tracking_no'] . '" target="_blank"><button>' . TEXT_TRACKING_BUTTONNAME . '</button></a></td>'  . ' </td>' . "\n";
			 }else{
			 $carrier='-module removed-';
			 $button='';
			 } 
         echo  sprintf(TEXT_TRACKING_INFO,$carrier,$orders_history['tracking_no']) . $button;
          } 
		echo   '          </tr>' . "\n";
		// tracking module end
      }

add echo in front of line 360.

correct code:

			 echo '            <td class="smallText">';

Also your table heading has tracking info first and then pdf invoice field, but in actual table you have invoice column before tracking column.

 

I suggest switch lines 314 and 315

            <td class="smallText" align="center"><strong><?php echo TABLE_HEADING_TRACK; ?></strong></td>
	    <td class="smallText" align="center"><strong><?php echo TABLE_HEADING_INVOICE; ?></strong></td>
Edited by tarmogr
Link to comment
Share on other sites

  • 1 month later...

Hi

 

below I put fix for orders.php file (only if you use PHP < 5.3;  reason: return blank page):

 

find:

$tracking_arr = array_filter($tracking_modules, function($v) { return $v['number'] !== ''; });//remove all other array elements but with the one with tracking number

replace with:

$array_filter = create_function('$v', 'return $v["number"] !== "";');
$tracking_arr = array_filter($tracking_modules, $array_filter);

That's all.

Bye :thumbsup:

 

 

osC 2.3.4

Link to comment
Share on other sites

  • 3 months later...

Hello,

 

I am installing this module, but when I get to this part I am having an issue:

 

FIND
 
         '            <td valign="top">' . (empty($statuses['comments']) ? ' ' : nl2br(tep_output_string_protected($statuses['comments']))) . '</td>' . "\n" .
         '          </tr>' . "\n";
          
REPLACE with:
 
         '            <td valign="top">' . (empty($statuses['comments']) ? ' ' : nl2br(tep_output_string_protected($statuses['comments'])));
         if (($statuses['tracking_methods_id'] !=='') && ($statuses['tracking_no']!=='')){
          if (!empty($statuses['comments'])) echo '<br>';
         if (!isset($tracking_name_array[$statuses['tracking_methods_id']])){
         echo $statuses['tracking_no'];
         }else{
         echo sprintf(TRACKING_INFO_TEXT,$tracking_name_array[$statuses['tracking_methods_id']]). '<a href="' . $tracking_url_array[$statuses['tracking_methods_id']] .
         $statuses['tracking_no'] . '" target="_blank"><button>' . $statuses['tracking_no'] . '</button></a>';
        }}
    echo     '</td>' . "\n" . '</tr>' . "\n";
 
---------------------------------------------    
7 in catalog/admin/includes/boxes/localization.php

 

 

 

My issue is that I cannot find the following in my file:

 

'            <td valign="top">' . (empty($statuses['comments']) ? ' ' : nl2br(tep_output_string_protected($statuses['comments']))) . '</td>' . "\n" .
         '          </tr>' . "\n";

 

So I am lost as to what to do now. All other instructions were followed perfectly without an issue.

I should note that I am using osCommerce v2.3.3.4-r1

 

Thanks in advance

Edited by LochlannGreyeyes
Link to comment
Share on other sites

As it turns out from further digging into the code the following doesn't exist:

 

Hello,

 

I am installing this module, but when I get to this part I am having an issue:

 

FIND
 
         '            <td valign="top">' . (empty($statuses['comments']) ? ' ' : nl2br(tep_output_string_protected($statuses['comments']))) . '</td>' . "\n" .
         '          </tr>' . "\n";
          
REPLACE with:
 
         '            <td valign="top">' . (empty($statuses['comments']) ? ' ' : nl2br(tep_output_string_protected($statuses['comments'])));
         if (($statuses['tracking_methods_id'] !=='') && ($statuses['tracking_no']!=='')){
          if (!empty($statuses['comments'])) echo '<br>';
         if (!isset($tracking_name_array[$statuses['tracking_methods_id']])){
         echo $statuses['tracking_no'];
         }else{
         echo sprintf(TRACKING_INFO_TEXT,$tracking_name_array[$statuses['tracking_methods_id']]). '<a href="' . $tracking_url_array[$statuses['tracking_methods_id']] .
         $statuses['tracking_no'] . '" target="_blank"><button>' . $statuses['tracking_no'] . '</button></a>';
        }}
    echo     '</td>' . "\n" . '</tr>' . "\n";
 
---------------------------------------------    
7 in catalog/admin/includes/boxes/localization.php

 

 

 

My issue is that I cannot find the following in my file:

 

'            <td valign="top">' . (empty($statuses['comments']) ? ' ' : nl2br(tep_output_string_protected($statuses['comments']))) . '</td>' . "\n" .
         '          </tr>' . "\n";

 

So I am lost as to what to do now. All other instructions were followed perfectly without an issue.

I should note that I am using osCommerce v2.3.3.4-r1

 

Thanks in advance

 

 

I found a "similar" line in the file **Guessing due to using 2.3.3.4** as follows:

 

'<div class="accountHistoryInfoOrderHistoryCommments">' . (empty($statuses['comments']) ? ' ' : nl2br(tep_output_string_protected($statuses['comments']))) . '</div>' . "\n" .
                
                '</div>' . "\n";

 

I made the necessary adjustments needed to replace this with what was needed...

 

Unfortunately, this module as written will not work with 2.3.3.4. Once code was adjusted other issues were also found on the admin side and the client side.

 

Thankfully a full backup was done before attempting the installation.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...