Jump to content


  • Content count

  • Joined

  • Last visited

1 Follower

Profile Information

  • Real Name
    Chris Canty
  • Gender
  • Location
    Sydney, Australia
  1. Blaise

    [Contribution] Option Types v2

    This may be of some help to others where they have no administrative control over their production MYSQL server and it is running in 'STRICT' mode...I was having a problem where I was getting a stop error in 'admin/product_attributes.php' when I tried to access 'Catalog|Product Attributes' through the admin pages.: The offending code (around line 29): tep_db_query("insert into " . TABLE_PRODUCTS_OPTIONS_VALUES . " (products_options_values_id, language_id, products_options_values_name) values ('" . OPTIONS_VALUES_TEXT_ID . "', '" . (int)$languages[$i]['id'] . "', '" . TEXT_UPLOAD_NAME . "')"); It was solved with the following change (simply typecast the OPTIONS_VALUES_TEXT_ID value as an integer): tep_db_query("insert into " . TABLE_PRODUCTS_OPTIONS_VALUES . " (products_options_values_id, language_id, products_options_values_name) values ('" . (int)OPTIONS_VALUES_TEXT_ID . "', '" . (int)$languages[$i]['id'] . "', '" . TEXT_UPLOAD_NAME . "')"); Cheers, Blaise
  2. Blaise

    [Contribution] Option Types v2

    Hi there, firstly thanks for such a great contribution (after managing to get it to finally work). I thought I'd share a little script I added to catalog/includes/modules/option_types.php for the radio button attributes. I wanted to have the first radio button of a group checked by default when the product was first opened (well, as a radio group, one item should be selected at all times). It checked if anything is checked first as a customer might click on the product from the shopping chart. Add this just before end of the OPTION_TYPE_RADIO switch statement. // jscript to "check" the first radio button if nothing is checked - Chris 13/07/2012 $tmp_html .= '<script>' . ' $(function() {' . ' if ($(\'input:radio[name=id[' . $ProdOpt_ID . ']]:checked\').val() == undefined) {' . ' $(\'input:radio[name=id[' . $ProdOpt_ID . ']]:nth(0)\').prop(\'checked\',true);' . ' }' . ' });' . '</script>'; Hope this is of use to others.
  3. Please note the replacement code in my instructions: $sort_suffix = '[b]<span class="ui-icon ' . (substr($sortby, 0, 1) == $colnum ? (substr($sortby, 1, 1) == 'a' ? 'ui-icon-triangle-1-n' : 'ui-icon-triangle-1-s') : 'ui-icon-carat-2-n-s') . '"></span></span></a>'; should read: $sort_suffix = '<span class="ui-icon ' . (substr($sortby, 0, 1) == $colnum ? (substr($sortby, 1, 1) == 'a' ? 'ui-icon-triangle-1-n' : 'ui-icon-triangle-1-s') : 'ui-icon-carat-2-n-s') . '"></span></span></a>'; Couldn't update the previous post (timeout on edits I assume).
  4. Not sure if this topic belongs here or in "Tips and Tricks". Feel free to move it if required. Hi all, been lurking on here for a few days and have recently started building an online store using osCommerce v2.3.1. I was unhappy with the standard "+" and "-" column sort indicators employed in product listing headers and stumbled across the Column Sort Arrows contribution that uses images instead. However, I also use Theme Switcher to set the colour scheme of my site and the arrow images used in aforementioned contribution are of a fixed colour and sort-of break the look of a theme (e.g. le-frog, sunny, redmond, start etc). I wanted something that didn't require any additional images to manage (other than what's already supplied within a theme from Theme Roller) and kept the look-n-feel of the active theme. So, what's needed to achieve this? Surprising little as it turns out... modify 2 files - catalog/stylesheet.css and catalog/includes/functions/general.php using the instructions below - In catalog/stylesheet.css, add a new style rule (I added this below the main ".productListingHeader" entry): .productListingHeader .ui-icon { display: inline-block; vertical-align: bottom; } In catalog/includes/functions/general.php, find within the tep_create_sort_heading() function (around line 892): $sort_suffix = (substr($sortby, 0, 1) == $colnum ? (substr($sortby, 1, 1) == 'a' ? '+' : '-') : '') . '</a>'; and replace the code with: $sort_suffix = '[b]<span class="ui-icon ' . (substr($sortby, 0, 1) == $colnum ? (substr($sortby, 1, 1) == 'a' ? 'ui-icon-triangle-1-n' : 'ui-icon-triangle-1-s') : 'ui-icon-carat-2-n-s') . '"></span></span></a>'; Replace the return of the function tep_create_sort_heading() from: return $sort_prefix . $heading . $sort_suffix; with: return $sort_prefix . '<span>' . $heading . $sort_suffix; Please note the use of the <span> tags (frustratingly, this took the most amount of time to get right). They are required to ensure the title justification remains unbroken, the hyperlinks don't extending across the entire column and prevents the titles running over two lines. I hope this is of some help to others.