Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Custom Computer Creator v9 Support


sw45859

Recommended Posts

Hi stephen - still no luck

 

Not too sure what it could be.

 

I am gonna try to see if it works on a clean install of MS2.

 

This way if it works - then it is likely to be another contribution or amendment I am using/have made.

 

Will let you know how it goes - give me a couple of minutes

 

Regards

 

Jiten

Link to comment
Share on other sites

  • Replies 542
  • Created
  • Last Reply

Top Posters In This Topic

Hi stephen

 

Just did a fresh install and redid all installation steps.

 

Now I have encountered a problem mentioned earlier. When adding a product and clicking on the radio button - nothing happens?

 

I think a function may be needed in admin/includes/function/general.php ?

 

Maybe when I installed it on my previous shop a function must have been inserted through another contribution?

 

Any ideas?

 

Regards

 

Jiten

Link to comment
Share on other sites

Hello,

 

For those of us who may wish to help debug this, have all the changes being discussed here been transferred to the contrib source code, so it can be uploaded?

Link to comment
Share on other sites

ok i have figured out the issue of adding products

 

I was wrong it was NOT general.php

 

THE file that needs changing is admin/includes/functions/html_output.php

 

Basically I do not know exactly what needs doing but the required code needed to make the adding of products work comes from the ADMIN ACCESS WITH LEVELS CONTRIBUTION. Here is a copy of my html_output.php file with the code from admin access with levels - I just included the whole code from that contribution in my html_output file as when i tried to be selective I was getting errors!

 

<?php
/*
 $Id: html_output.php,v 1.29 2003/06/25 20:32:44 hpdl Exp $

 osCommerce, Open Source E-Commerce Solutions
 http://www.oscommerce.com

 Copyright (c) 2003 osCommerce

 Released under the GNU General Public License
*/

////
// The HTML href link wrapper function
 function tep_href_link($page = '', $parameters = '', $connection = 'NONSSL') {
   if ($page == '') {
     die('</td></tr></table></td></tr></table><br><br><font color="#ff0000"><b>Error!</b></font><br><br><b>Unable to determine the page link!<br><br>Function used:<br><br>tep_href_link(\'' . $page . '\', \'' . $parameters . '\', \'' . $connection . '\')</b>');
   }
   if ($connection == 'NONSSL') {
     $link = HTTP_SERVER . DIR_WS_ADMIN;
   } elseif ($connection == 'SSL') {
     if (ENABLE_SSL == 'true') {
       $link = HTTPS_SERVER . DIR_WS_ADMIN;
     } else {
       $link = HTTP_SERVER . DIR_WS_ADMIN;
     }
   } else {
     die('</td></tr></table></td></tr></table><br><br><font color="#ff0000"><b>Error!</b></font><br><br><b>Unable to determine connection method on a link!<br><br>Known methods: NONSSL SSL<br><br>Function used:<br><br>tep_href_link(\'' . $page . '\', \'' . $parameters . '\', \'' . $connection . '\')</b>');
   }
   if ($parameters == '') {
     $link = $link . $page . '?' . SID;
   } else {
     $link = $link . $page . '?' . $parameters . '&' . SID;
   }

   while ( (substr($link, -1) == '&') || (substr($link, -1) == '?') ) $link = substr($link, 0, -1);

   return $link;
 }

 function tep_catalog_href_link($page = '', $parameters = '', $connection = 'NONSSL') {
   if ($connection == 'NONSSL') {
     $link = HTTP_CATALOG_SERVER . DIR_WS_CATALOG;
   } elseif ($connection == 'SSL') {
     if (ENABLE_SSL_CATALOG == 'true') {
       $link = HTTPS_CATALOG_SERVER . DIR_WS_CATALOG;
     } else {
       $link = HTTP_CATALOG_SERVER . DIR_WS_CATALOG;
     }
   } else {
     die('</td></tr></table></td></tr></table><br><br><font color="#ff0000"><b>Error!</b></font><br><br><b>Unable to determine connection method on a link!<br><br>Known methods: NONSSL SSL<br><br>Function used:<br><br>tep_href_link(\'' . $page . '\', \'' . $parameters . '\', \'' . $connection . '\')</b>');
   }
   if ($parameters == '') {
     $link .= $page;
   } else {
     $link .= $page . '?' . $parameters;
   }

   while ( (substr($link, -1) == '&') || (substr($link, -1) == '?') ) $link = substr($link, 0, -1);

   return $link;
 }

////
// The HTML image wrapper function
 function tep_image($src, $alt = '', $width = '', $height = '', $params = '') {
   $image = '<img src="' . $src . '" border="0" alt="' . $alt . '"';
   if ($alt) {
     $image .= ' title=" ' . $alt . ' "';
   }
   if ($width) {
     $image .= ' width="' . $width . '"';
   }
   if ($height) {
     $image .= ' height="' . $height . '"';
   }
   if ($params) {
     $image .= ' ' . $params;
   }
   $image .= '>';

   return $image;
 }

////
// The HTML form submit button wrapper function
// Outputs a button in the selected language
 function tep_image_submit($image, $alt = '', $parameters = '') {
   global $language;

   $image_submit = '<input type="image" src="' . tep_output_string(DIR_WS_LANGUAGES . $language . '/images/buttons/' . $image) . '" border="0" alt="' . tep_output_string($alt) . '"';

   if (tep_not_null($alt)) $image_submit .= ' title=" ' . tep_output_string($alt) . ' "';

   if (tep_not_null($parameters)) $image_submit .= ' ' . $parameters;

   $image_submit .= '>';

   return $image_submit;
 }

////
// Draw a 1 pixel black line
 function tep_black_line() {
   return tep_image(DIR_WS_IMAGES . 'pixel_black.gif', '', '100%', '1');
 }

////
// Output a separator either through whitespace, or with an image
 function tep_draw_separator($image = 'pixel_black.gif', $width = '100%', $height = '1') {
   return tep_image(DIR_WS_IMAGES . $image, '', $width, $height);
 }

////
// Output a function button in the selected language
 function tep_image_button($image, $alt = '', $params = '') {
   global $language;

   return tep_image(DIR_WS_LANGUAGES . $language . '/images/buttons/' . $image, $alt, '', '', $params);
 }

////
// javascript to dynamically update the states/provinces list when the country is changed
// TABLES: zones
 function tep_js_zone_list($country, $form, $field) {
   $countries_query = tep_db_query("select distinct zone_country_id from " . TABLE_ZONES . " order by zone_country_id");
   $num_country = 1;
   $output_string = '';
   while ($countries = tep_db_fetch_array($countries_query)) {
     if ($num_country == 1) {
       $output_string .= '  if (' . $country . ' == "' . $countries['zone_country_id'] . '") {' . "\n";
     } else {
       $output_string .= '  } else if (' . $country . ' == "' . $countries['zone_country_id'] . '") {' . "\n";
     }

     $states_query = tep_db_query("select zone_name, zone_id from " . TABLE_ZONES . " where zone_country_id = '" . $countries['zone_country_id'] . "' order by zone_name");

     $num_state = 1;
     while ($states = tep_db_fetch_array($states_query)) {
       if ($num_state == '1') $output_string .= '    ' . $form . '.' . $field . '.options[0] = new Option("' . PLEASE_SELECT . '", "");' . "\n";
       $output_string .= '    ' . $form . '.' . $field . '.options[' . $num_state . '] = new Option("' . $states['zone_name'] . '", "' . $states['zone_id'] . '");' . "\n";
       $num_state++;
     }
     $num_country++;
   }
   $output_string .= '  } else {' . "\n" .
                     '    ' . $form . '.' . $field . '.options[0] = new Option("' . TYPE_BELOW . '", "");' . "\n" .
                     '  }' . "\n";

   return $output_string;
 }

////
// Output a form
 function tep_draw_form($name, $action, $parameters = '', $method = 'post', $params = '') {
   $form = '<form name="' . tep_output_string($name) . '" action="';
   if (tep_not_null($parameters)) {
     $form .= tep_href_link($action, $parameters);
   } else {
     $form .= tep_href_link($action);
   }
   $form .= '" method="' . tep_output_string($method) . '"';
   if (tep_not_null($params)) {
     $form .= ' ' . $params;
   }
   $form .= '>';

   return $form;
 }

////
// Output a form input field
 function tep_draw_input_field($name, $value = '', $parameters = '', $required = false, $type = 'text', $reinsert_value = true) {
   $field = '<input type="' . tep_output_string($type) . '" name="' . tep_output_string($name) . '"';

   if (isset($GLOBALS[$name]) && ($reinsert_value == true) && is_string($GLOBALS[$name])) {
     $field .= ' value="' . tep_output_string(stripslashes($GLOBALS[$name])) . '"';
   } elseif (tep_not_null($value)) {
     $field .= ' value="' . tep_output_string($value) . '"';
   }

   if (tep_not_null($parameters)) $field .= ' ' . $parameters;

   $field .= '>';

   if ($required == true) $field .= TEXT_FIELD_REQUIRED;

   return $field;
 }

////
// Output a form password field
 function tep_draw_password_field($name, $value = '', $required = false) {
   $field = tep_draw_input_field($name, $value, 'maxlength="40"', $required, 'password', false);

   return $field;
 }

////
// Output a form filefield
 function tep_draw_file_field($name, $required = false) {
   $field = tep_draw_input_field($name, '', '', $required, 'file');

   return $field;
 }

//Admin begin
////
// Output a selection field - alias function for tep_draw_checkbox_field() and tep_draw_radio_field()
//  function tep_draw_selection_field($name, $type, $value = '', $checked = false, $compare = '') {
//    $selection = '<input type="' . tep_output_string($type) . '" name="' . tep_output_string($name) . '"';
//
//    if (tep_not_null($value)) $selection .= ' value="' . tep_output_string($value) . '"';
//
//    if ( ($checked == true) || (isset($GLOBALS[$name]) && is_string($GLOBALS[$name]) && ($GLOBALS[$name] == 'on')) || (isset($value) && isset($GLOBALS[$name]) && (stripslashes($GLOBALS[$name]) == $value)) || (tep_not_null($value) && tep_not_null($compare) && ($value == $compare)) ) {
//      $selection .= ' CHECKED';
//    }
//
//    $selection .= '>';
//
//    return $selection;
//  }
//
////
// Output a form checkbox field
//  function tep_draw_checkbox_field($name, $value = '', $checked = false, $compare = '') {
//    return tep_draw_selection_field($name, 'checkbox', $value, $checked, $compare);
//  }
//
////
// Output a form radio field
//  function tep_draw_radio_field($name, $value = '', $checked = false, $compare = '') {
//    return tep_draw_selection_field($name, 'radio', $value, $checked, $compare);
//  }
////
// Output a selection field - alias function for tep_draw_checkbox_field() and tep_draw_radio_field()
 function tep_draw_selection_field($name, $type, $value = '', $checked = false, $compare = '', $parameter = '') {
   $selection = '<input type="' . $type . '" name="' . $name . '"';
   if ($value != '') {
     $selection .= ' value="' . $value . '"';
   }
   if ( ($checked == true) || ($GLOBALS[$name] == 'on') || ($value && ($GLOBALS[$name] == $value)) || ($value && ($value == $compare)) ) {
     $selection .= ' CHECKED';
   }
   if ($parameter != '') {
     $selection .= ' ' . $parameter;
   }   
   $selection .= '>';

   return $selection;
 }

////
// Output a form checkbox field
 function tep_draw_checkbox_field($name, $value = '', $checked = false, $compare = '', $parameter = '') {
   return tep_draw_selection_field($name, 'checkbox', $value, $checked, $compare, $parameter);
 }

////
// Output a form radio field
 function tep_draw_radio_field($name, $value = '', $checked = false, $compare = '', $parameter = '') {
   return tep_draw_selection_field($name, 'radio', $value, $checked, $compare, $parameter);
 }
//Admin end

////
// Output a form textarea field
 function tep_draw_textarea_field($name, $wrap, $width, $height, $text = '', $parameters = '', $reinsert_value = true) {
   $field = '<textarea name="' . tep_output_string($name) . '" wrap="' . tep_output_string($wrap) . '" cols="' . tep_output_string($width) . '" rows="' . tep_output_string($height) . '"';

   if (tep_not_null($parameters)) $field .= ' ' . $parameters;

   $field .= '>';

   if ( (isset($GLOBALS[$name])) && ($reinsert_value == true) ) {
     $field .= stripslashes($GLOBALS[$name]);
   } elseif (tep_not_null($text)) {
     $field .= $text;
   }

   $field .= '</textarea>';

   return $field;
 }

////
// Output a form hidden field
 function tep_draw_hidden_field($name, $value = '', $parameters = '') {
   $field = '<input type="hidden" name="' . tep_output_string($name) . '"';

   if (tep_not_null($value)) {
     $field .= ' value="' . tep_output_string($value) . '"';
   } elseif (isset($GLOBALS[$name]) && is_string($GLOBALS[$name])) {
     $field .= ' value="' . tep_output_string(stripslashes($GLOBALS[$name])) . '"';
   }

   if (tep_not_null($parameters)) $field .= ' ' . $parameters;

   $field .= '>';

   return $field;
 }

////
// Output a form pull down menu
 function tep_draw_pull_down_menu($name, $values, $default = '', $parameters = '', $required = false) {
   $field = '<select name="' . tep_output_string($name) . '"';

   if (tep_not_null($parameters)) $field .= ' ' . $parameters;

   $field .= '>';

   if (empty($default) && isset($GLOBALS[$name])) $default = stripslashes($GLOBALS[$name]);

   for ($i=0, $n=sizeof($values); $i<$n; $i++) {
     $field .= '<option value="' . tep_output_string($values[$i]['id']) . '"';
     if ($default == $values[$i]['id']) {
       $field .= ' SELECTED';
     }

     $field .= '>' . tep_output_string($values[$i]['text'], array('"' => '"', '\'' => ''', '<' => '<', '>' => '>')) . '</option>';
   }
   $field .= '</select>';

   if ($required == true) $field .= TEXT_FIELD_REQUIRED;

   return $field;
 }
?>

 

This was added to an unmodified html_output.php file

 

MAKE SURE YOU BACKUP!!!

 

Regards

 

Jiten

Link to comment
Share on other sites

Did you install the admin access with levels before creating CCC?

 

maybe it allows some function or something to occur that the stock MS2 version does not?

 

I am not sure what is happening as I do not really know PHP!!! ;)

 

I use trial and error! :blink:

 

But when I added the code from admin access with levels it worked! Other than that piece of code and your code for CCC I have a completely fresh test version of MS2!

 

Dunno whats going on?!

 

regards

 

Jiten

Link to comment
Share on other sites

i got it

i did change that file and forgot to mark it

ok in the includes/functions/html_output.php change:

// Output a form radio field
function tep_draw_radio_field($name, $value = '', $checked = false, $compare = '') {
? return tep_draw_selection_field($name, 'radio', $value, $checked, $compare);
}

to

// Output a form radio field
function tep_draw_radio_field($name, $value = '', $checked = false, $compare = '', $params = '') {
? return tep_draw_selection_field($name, 'radio', $value, $checked, $compare, $params);
}

and on line 209 replace:

  function tep_draw_selection_field($name, $type, $value = '', $checked = false, $compare = '') {

with

  function tep_draw_selection_field($name, $type, $value = '', $checked = false, $compare = '', $params = '') {

Edited by sw45859
Link to comment
Share on other sites

wow! thats wierd?

 

I do not have a clue? I reverted back to the original html_output file and products would not add.

 

sorry I cannot be of much more use as i have no idea what it could be?

 

I have commented out the original code and below it but the new code supplied by admin access with levels. The new code is this:

 

// Output a selection field - alias function for tep_draw_checkbox_field() and tep_draw_radio_field()
 function tep_draw_selection_field($name, $type, $value = '', $checked = false, $compare = '', $parameter = '') {
   $selection = '<input type="' . $type . '" name="' . $name . '"';
   if ($value != '') {
     $selection .= ' value="' . $value . '"';
   }
   if ( ($checked == true) || ($GLOBALS[$name] == 'on') || ($value && ($GLOBALS[$name] == $value)) || ($value && ($value == $compare)) ) {
     $selection .= ' CHECKED';
   }
   if ($parameter != '') {
     $selection .= ' ' . $parameter;
   }   
   $selection .= '>';

   return $selection;
 }

////
// Output a form checkbox field
 function tep_draw_checkbox_field($name, $value = '', $checked = false, $compare = '', $parameter = '') {
   return tep_draw_selection_field($name, 'checkbox', $value, $checked, $compare, $parameter);
 }

////
// Output a form radio field
 function tep_draw_radio_field($name, $value = '', $checked = false, $compare = '', $parameter = '') {
   return tep_draw_selection_field($name, 'radio', $value, $checked, $compare, $parameter);
 }
//Admin end

 

Hope this helps?

 

Jiten

Link to comment
Share on other sites

Admin/Includes/Functions /html_output.php
Around Line 209 Replace: 
// Output a selection field - alias function for tep_draw_checkbox_field() and tep_draw_radio_field()
 function tep_draw_selection_field($name, $type, $value = '', $checked = false, $compare = '') {
   $selection = '<input type="' . tep_output_string($type) . '" name="' . tep_output_string($name) . '"';

   if (tep_not_null($value)) $selection .= ' value="' . tep_output_string($value) . '"';

   if ( ($checked == true) || (isset($GLOBALS[$name]) && is_string($GLOBALS[$name]) && ($GLOBALS[$name] == 'on')) || (isset($value) && isset($GLOBALS[$name]) && (stripslashes($GLOBALS[$name]) == $value)) || (tep_not_null($value) && tep_not_null($compare) && ($value == $compare)) ) {
     $selection .= ' CHECKED';
   }

   $selection .= '>';

   return $selection;
 }
 
With: 
// Output a selection field - alias function for tep_draw_checkbox_field() and tep_draw_radio_field()
 function tep_draw_selection_field($name, $type, $value = '', $checked = false, $compare = '', $params = '') {
   $selection = '<input type="' . tep_output_string($type) . '" name="' . tep_output_string($name) . '"';

   if (tep_not_null($value)) $selection .= ' value="' . tep_output_string($value) . '"';
   if (tep_not_null($params)) $selection .= $params;

   if ( ($checked == true) || (isset($GLOBALS[$name]) && is_string($GLOBALS[$name]) && ($GLOBALS[$name] == 'on')) || (isset($value) && isset($GLOBALS[$name]) && (stripslashes($GLOBALS[$name]) == $value)) || (tep_not_null($value) && tep_not_null($compare) && ($value == $compare)) ) {
     $selection .= ' CHECKED';
   }

   $selection .= '>';

   return $selection;
 }

Around Line 231 Replace: 
// Output a form radio field
 function tep_draw_radio_field($name, $value = '', $checked = false, $compare = '') {
   return tep_draw_selection_field($name, 'radio', $value, $checked, $compare);
 }
 
With: 
// Output a form radio field
 function tep_draw_radio_field($name, $value = '', $checked = false, $compare = '', $params = '') {
   return tep_draw_selection_field($name, 'radio', $value, $checked, $compare, $params);
 }

that should fix that problem

Link to comment
Share on other sites

Sorry you beat me to the posting!

 

OK - with the previous changes that you have made I have got the listing of products on account_history_info.php! GREAT

 

But it still does not show in the shopping_cart.php, checkout_confirmation.php nor anywhere in the admin side.

 

Thanks

 

Jiten

Link to comment
Share on other sites

Sorry you beat me to the posting!

 

OK - with the previous changes that you have made I have got the listing of products on account_history_info.php! GREAT

 

But it still does not show in the shopping_cart.php, checkout_confirmation.php nor anywhere in the admin side.

 

Thanks

 

Jiten

ok can you click on the name in the cart and get the description?

Link to comment
Share on other sites

ok can you click on the name in the cart and get the description?

 

No. The name is not clickable.

 

By the way... as I am doing this stock I will mark all the changes in all the requisite files so when everything is finished we can have a complete fresh MS2 with the contrib ready to use and installed - if you want? this is with images etc

 

Regards

 

Jiten

Link to comment
Share on other sites

Ok here is a list of the issues remaining:

 

1. Invoice/Packing slip do not list components

2. Admin/orders.php does not list components

3. Catalog/shopping_cart.php does not list components

4. catalog/checkout_confirmation.php does not list components

5. Sessions lost on catalog/ccc.php when a FSB speed is selected

 

Those are the issues that are remaining that prevent the contribution from being functional - once these are sorted out I think it may be 100% functional for a live site!

 

There may be improvements here and there - like the ability to go back and revise the system from custom_checkout.php. I tried to add a link back to build.php but the product information is lost.

 

Those are the immediate things I can think of.

 

Regards

 

Jiten

Link to comment
Share on other sites

I am going to retrace steps and see if we can get this working.

 

Sessions disappear when you click on any of the FSB speeds. I remember once sorting out a session issue by changing

 

... 'NONSSL', false

 

to:

 

...  'NONSSL', true

 

However, I would not know how that would be implemented into the form that you have used linking to the FSB speeds?

 

Will let you know progress with your new instructions!

Link to comment
Share on other sites

Hello Stephen!

 

GOOD NEWS I MAY HAVE FIGURED IT OUT!!!!!!!

 

I was looking at why it was showing the list of products in account_history_info.php and not any other page!

 

What the shopping_cart.php and etc lack is "pd.products_description" in the

 

$products_query = tep_db_query

 

In shopping_cart.php I changed line 273 from:

 

        $products_query = tep_db_query("select p.products_id, pd.products_name, p.products_model, p.products_image, p.products_price, p.products_weight, p.products_tax_class_id from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd where p.products_id = '" . (int)$products_id . "' and pd.products_id = p.products_id and pd.language_id = '" . (int)$languages_id . "'");

 

to this:

 

        $products_query = tep_db_query("select p.products_id, pd.products_description, pd.products_name, p.products_model, p.products_image, p.products_price, p.products_weight, p.products_tax_class_id from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd where p.products_id = '" . (int)$products_id . "' and pd.products_id = p.products_id and pd.language_id = '" . (int)$languages_id . "'");

 

Notice the pd.products_description - now I can see the listing of products in the shopping cart!

 

Just want your confirmation that I am doing the right thing before i continue!

 

Regards

 

Jiten

Link to comment
Share on other sites

Yes - now the products are being listed on the following pages:

 

1. catalog/shopping_cart.php

2. catalog/checkout_confirmation.php

3. catalog/account_history_info.php

 

Unfortunately - still not showing on the admin side? Nor in the invoices??? I will upload it soon to a website so you can see.

 

Any ideas - maybe pd.products_description needs to be added in admin/includes/classes/orders.php?

 

Regards

 

Jiten

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