Jump to content
Sign in to follow this  
bkiani

Simple tracking module

Recommended Posts

This is a new add-on created by another shop owner @@tarmogr

 

Best is to contact him/her directly and ask for a support thread to be set up so that people in the future can also ask questions in the same thread.

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
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

Share this post


Link to post
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

Share this post


Link to post
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

Share this post


Link to post
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?

Share this post


Link to post
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. 

Share this post


Link to post
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

Share this post


Link to post
Share on other sites

 

Are you going to help him to restore?

 

 

Ofcourse

 

thankyou tarmogr

data base restored

Share this post


Link to post
Share on other sites

@@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

Share this post


Link to post
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

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
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.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×