Jump to content
Latest News: (loading..)

Portman

Members
  • Content count

    65
  • Joined

  • Last visited

1 Follower

Profile Information

  • Real Name
    Pete

Recent Profile Visitors

2,453 profile views
  1. Portman

    Help Updating Module

    thanks @raiwa... just slightly embarrassed
  2. Hi everyone, I have installed the Modular Checkout pages addon so that I can add a modal info box to the products section of checkout_confirmation.... I have go it to work.... sort of ish... I include below my Modified includes/modules/content/checkout_confirmation/cm_cc_products.php file ... <?php /* $Id$ Modular Checkout by @raiwa info@oscaddons.com www.oscaddons.com osCommerce, Open Source E-Commerce Solutions http://www.oscommerce.com Copyright (c) 2018 osCommerce Released under the GNU General Public License */ class cm_cc_products { var $code; var $group; var $title; var $description; var $sort_order; var $enabled = false; function __construct() { $this->code = get_class($this); $this->group = basename(dirname(__FILE__)); $this->title = MODULE_CONTENT_CHECKOUT_CONFIRMATION_PRODUCTS_TITLE; $this->description = MODULE_CONTENT_CHECKOUT_CONFIRMATION_PRODUCTS_DESCRIPTION; $this->description .= '<div class="secWarning">' . MODULE_CONTENT_BOOTSTRAP_ROW_DESCRIPTION . '</div>'; if ( defined('MODULE_CONTENT_CHECKOUT_CONFIRMATION_PRODUCTS_STATUS') ) { $this->sort_order = MODULE_CONTENT_CHECKOUT_CONFIRMATION_PRODUCTS_SORT_ORDER; $this->enabled = (MODULE_CONTENT_CHECKOUT_CONFIRMATION_PRODUCTS_STATUS == 'True'); } } function execute() { global $oscTemplate, $order, $currencies, $order_total_modules; $content_width = (int)MODULE_CONTENT_CHECKOUT_CONFIRMATION_PRODUCTS_CONTENT_WIDTH; ob_start(); include('includes/modules/content/' . $this->group . '/templates/tpl_' . basename(__FILE__)); $template = ob_get_clean(); $oscTemplate->addContent($template, $this->group); } function isEnabled() { return $this->enabled; } function check() { return defined('MODULE_CONTENT_CHECKOUT_CONFIRMATION_PRODUCTS_STATUS'); } function install() { tep_db_query("insert into configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Enable Products information', 'MODULE_CONTENT_CHECKOUT_CONFIRMATION_PRODUCTS_STATUS', 'True', 'Should this module be shown on the checkout confirmation page?', '6', '1', 'tep_cfg_select_option(array(\'True\', \'False\'), ', now())"); tep_db_query("insert into configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Content Width', 'MODULE_CONTENT_CHECKOUT_CONFIRMATION_PRODUCTS_CONTENT_WIDTH', '12', 'What width container should the content be shown in?', '6', '1', 'tep_cfg_select_option(array(\'12\', \'11\', \'10\', \'9\', \'8\', \'7\', \'6\', \'5\', \'4\', \'3\', \'2\', \'1\'), ', now())"); tep_db_query("insert into configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Sort Order', 'MODULE_CONTENT_CHECKOUT_CONFIRMATION_PRODUCTS_SORT_ORDER', '200', 'Sort order of display. Lowest is displayed first.', '6', '1', now())"); * tep_db_query("insert into configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Modal Name', 'MODULE_CONTENT_CHECKOUT_CONFIRMATION_PRODUCTS_MODAL_BUTTONNAME', 'Latest Updates', 'Name for your custom box', '6', '8', now())"); * tep_db_query("insert into configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Modal class', 'MODULE_CONTENT_CHECKOUT_CONFIRMATION_PRODUCTS_MODAL_BUTTONCLASS', 'btn btn-primary', 'class', '6', '8', now())"); * tep_db_query("insert into configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Modal Box title', 'MODULE_CONTENT_CHECKOUT_CONFIRMATION_PRODUCTS_MODAL_TITLE', 'Information', 'title', '6', '8', now())"); * tep_db_query("insert into configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Modal Box content', 'MODULE_CONTENT_CHECKOUT_CONFIRMATION_PRODUCTS_MODAL_BODY', 'put your info here', 'modal content', '6', '8', now())"); } function remove() { tep_db_query("delete from configuration where configuration_key in ('" . implode("', '", $this->keys()) . "')"); } function keys() { return array('MODULE_CONTENT_CHECKOUT_CONFIRMATION_PRODUCTS_STATUS', 'MODULE_CONTENT_CHECKOUT_CONFIRMATION_PRODUCTS_CONTENT_WIDTH', 'MODULE_CONTENT_CHECKOUT_CONFIRMATION_PRODUCTS_SORT_ORDER' * 'MODULE_CONTENT_CHECKOUT_CONFIRMATION_PRODUCTS_MODAL_BUTTONNAME', * 'MODULE_CONTENT_CHECKOUT_CONFIRMATION_PRODUCTS_MODAL_BUTTONCLASS', * 'MODULE_CONTENT_CHECKOUT_CONFIRMATION_PRODUCTS_MODAL_TITLE', * 'MODULE_CONTENT_CHECKOUT_CONFIRMATION_PRODUCTS_MODAL_BODY'); } } I have added an '*' to the start of each line I have added ... as I said the modal part works my problem is that when I navigate to the Modules>Content>Products section of admin the extra fields I have created do not show up, essentially it looks identical to how it did before I added the extra lines of test. Likewise, when I save the changes to the module the default text that I have assigned to the fields does not show up... I only get the placeholders/variables showing up I have uninstalled and reinstalled the module a number of times, there is obviously something I am missing in modifying this file, any help would be appreciated.
  3. Hi, I am having trouble with currency conversion.... I am using BS Frozen, The function for XE in localization.php looks like this... function quote_xe_currency($to, $from = DEFAULT_CURRENCY) { $page = file('http://www.xe.com/currencyconverter/convert/?Amount=1&From=' . $from . '&To=' . $to); $match = array(); preg_match('/[0-9.]+\s*' . $from . '\s*=\s*([0-9.]+)\s*' . $to . '/', implode('', $page), $match); if (sizeof($match) > 0) { return $match[1]; } else { return false; } } I updated the link according to some stuff I read in another post and if I manually enter the link a browser it works fine.... THere have been no modifications to other files that may be related as far as I know. every time I click the 'Update Exchange Rate' button in the currencies section I get the following errors... Warning: The primary exchange rate server (xe) failed for AUS Dollar (AUD) - trying the secondary exchange rate server. The exchange rate for AUS Dollar (AUD) was updated successfully via fixer. Warning: The primary exchange rate server (xe) failed for Euro (EUR) - trying the secondary exchange rate server. Error: The exchange rate for Euro (EUR) was not updated via fixer. Is it a valid currency code? Warning: The primary exchange rate server (xe) failed for U.S. Dollar (USD) - trying the secondary exchange rate server. Error: The exchange rate for U.S. Dollar (USD) was not updated via fixer. Is it a valid currency code? Warning: The primary exchange rate server (xe) failed for Pounds Sterling (GBP) - trying the secondary exchange rate server. Error: The exchange rate for Pounds Sterling (GBP) was not updated via fixer. Is it a valid currency code? Warning: The primary exchange rate server (xe) failed for Canadian Dollar (CAD) - trying the secondary exchange rate server. Error: The exchange rate for Canadian Dollar (CAD) was not updated via fixer. Is it a valid currency code? AUD is my Default Currency.... Is there anything else I need to look at to try and fix this issue?
  4. Portman

    Help with Modal Addons

    Thanks @JcMagpie, is this the one you are suggesting? https://apps.oscommerce.com/89uS9&modular-checkout-pages-bs
  5. Hi, Is there a particular modal Addon that I can add to the main body of my website... rather than in the left or right box or shopping cart type sections. I have one or two places on my website (one on checkout_confirmation page, and 'Ill probably want to add one on the payment page as well) .... If there is not one for my particular need then what would be the best addon for me to modify (particularly thinking I will need a couple of them operating at once on different pages) I am using the most up to date BS frozen
  6. Hi.... I am trying to modify my admin/specials.php file so that I can change the price for multiple "wholesale" customer groups (think SPPC) I have got it to work for a price value, but I am trying to make it work for a percentage and that is where I am coming unstuck... can someone have a look at the following code and help me out .... case 'update': $specials_id = tep_db_prepare_input($_POST['specials_id']); $products_price = tep_db_prepare_input($_POST['products_price']); $specials_price = tep_db_prepare_input($_POST['specials_price']); $expdate = tep_db_prepare_input($_POST['expdate']); // Added by peter for Wholesale special prices $array_specials_ws_price = array(); for ($i=1; $i<=MODULE_STORE_WHOLESALE_GROUPS; $i++) { $value_specials_ws_price = ['specials_price_ws_' . $i]; $wholesale_price = ("products_ws_price_$i"); $value_specials_ws_price = tep_db_prepare_input($_POST['specials_price_ws_' . $i]); if (substr($value_specials_ws_price, -1) == '%') { $new_special_ws_insert_query = tep_db_query("select products_id, products_ws_price_1 from " . TABLE_PRODUCTS . " where products_id = '" . (int)$products_id . "'"); $new_special_ws_insert = tep_db_fetch_array($new_special_ws_insert_query); $wholesale_price_holder = $new_special_ws_insert['products_ws_price_1']; $value_specials_ws_price = ($wholesale_price_holder - (($value_specials_ws_price / 100) * $wholesale_price_holder)); } $array_specials_ws_price[] = ("specials_new_ws_price_$i = " . $value_specials_ws_price); // ********************************************************************* } $array_specials_ws_price = implode(', ', $array_specials_ws_price); // EOF Added by Peter if (substr($specials_price, -1) == '%') $specials_price = ($products_price - (($specials_price / 100) * $products_price)); $expires_date = ''; if (tep_not_null($expdate)) { $expires_date = substr($expdate, 0, 4) . substr($expdate, 5, 2) . substr($expdate, 8, 2); } // Next Line modified By Peter for Wholesale special prices tep_db_query("update " . TABLE_SPECIALS . " set specials_new_products_price = '" . tep_db_input($specials_price) . "', $array_specials_ws_price, specials_last_modified = now(), expires_date = " . (tep_not_null($expires_date) ? "'" . tep_db_input($expires_date) . "'" : 'null') . " where specials_id = '" . (int)$specials_id . "'"); tep_redirect(tep_href_link('specials.php', 'page=' . $_GET['page'] . '&sID=' . $specials_id)); break; I have simplified it a bit to try and find what I am doing wrong... my hope is to select the value in $wholesale_price in the query eventually, but for now I am querying a static field "products_ws_price_1". Basically, when I enter a percentage in the first field , but put price values in the other fields I get this error ; 1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ' specials_new_ws_price_2 = 32.0000, specials_new_ws_price_3 = 33.0000, specials_' at line 1 update specials set specials_new_products_price = '28.7920', specials_new_ws_price_1 = , specials_new_ws_price_2 = 32.0000, specials_new_ws_price_3 = 33.0000, specials_new_ws_price_4 = 34.0000, specials_new_ws_price_5 = 35.0000, specials_new_ws_price_6 = 36.0000, specials_new_ws_price_7 = 37.0000, specials_last_modified = now(), expires_date = '20190301' where specials_id = '6' Any help would be appreciated.
  7. Portman

    Updating admin/specials.php

    never mind.... sorted it out.... I assume this ok, or is there a better way to do it?... for ($i=1; $i<=x; $i++) { $temp_holder = "specials_new_ws_price_$i"; $specials_new_ws_prices = ($sInfo->$temp_holder); echo $specials_new_ws_prices; }
  8. Portman

    Updating admin/specials.php

    Hi everyone... can someone please help me out with this one.... I'm trying to get this to work... for ($i=1; $i<=x; $i++) { $specials_new_ws_prices = ($sInfo->specials_new_ws_price_$i); echo $specials_new_ws_prices ; } obviously I get a "syntax error, unexpected '$i' (T_VARIABLE)" on the above... if I change it to; $specials_new_ws_prices = ($sInfo->specials_new_ws_price_1); It prints the correct value from the database, so how do I make it work using the value of $i The idea is to populate an input field in the loop. Thanks,
  9. Portman

    Updating admin/specials.php

    Thanks @Dan Cole I think that has done what I am hoping to do.... now to see if I can recreate it!!
  10. Portman

    Updating admin/specials.php

    Sorry, my above example does not make a lot of sense.... can I create 2 arrays... 1 with the table labels ... 1 with the record values and then add them to the tep_db_query line.... this sort of thing.... $array_labels = for ($i=1; $i<=xxx; $i++) { table_label_ . $i; } $array_values = for ($i=1; $i<=xxx; $i++) { insert_new_special_price_ . $i; } tep_db_query("insert into " . TABLE_SPECIALS . " (products_id, specials_new_products_price, . '" $array_labels "' . specials_date_added, expires_date, status) values ('" . (int)$products_id . "', '" . tep_db_input($specials_price) . "', '" . $array_values . "' ,now(), " . (tep_not_null($expires_date) ? "'" . tep_db_input($expires_date) . "'" : 'null') . ", '1')");
  11. Hi, I'm trying to modify the admin/specials.php page so that i can update multiple different prices for different groups (think SPPC or Wholesale Lite) I am playing around with the update and insert section of the file... tep_db_query("insert into " . TABLE_SPECIALS . " (products_id, specials_new_products_price, specials_date_added, expires_date, status) values ('" . (int)$products_id . "', '" . tep_db_input($specials_price) . "', now(), " . (tep_not_null($expires_date) ? "'" . tep_db_input($expires_date) . "'" : 'null') . ", '1')"); tep_db_query("update " . TABLE_SPECIALS . " set specials_new_products_price = '" . tep_db_input($specials_price) . "', specials_last_modified = now(), expires_date = " . (tep_not_null($expires_date) ? "'" . tep_db_input($expires_date) . "'" : 'null') . " where specials_id = '" . (int)$specials_id . "'"); but I need to make a loop so that I can insert the multiple different prices.... In an attempt to get across what I want to do here is what my thought process is in a broken code kind of way... tep_db_query("insert into " . TABLE_SPECIALS . " (products_id, specials_new_products_price, ... for ($i=1; $i<=xxx; $i++) { insert_new_special_price_ . $i; } ... specials_date_added, expires_date, status) values ('" . (int)$products_id . "', '" . tep_db_input($specials_price) . "', now(), " . (tep_not_null($expires_date) ? "'" . tep_db_input($expires_date) . "'" : 'null') . ", '1')"); I have been trying different things and been looking around for solutions, but for the life of me I cant get it to work. Can anyone give me some help
  12. thanks @multimixer I was trying to plug the variable in there rather than the record from the database...
  13. Ok, so I'm playing around with hiding particular products from particular customers... I have made a variable $hide_product where the value 1 means the product is hidden and 0 means it is visible... I am trying to modify bm_specials.php and bm_whats_new.php so that if $hide_product = 1 that product does not show up in the box and another is selected... Im assuming it is these lines of code I need to modify, but for the life of me I can't figure it out bm_specials.php if ($random_product = tep_random_select("select p.products_id, pd.products_name, p.products_price, p.products_tax_class_id, p.products_image, s.specials_new_products_price from products p, products_description pd, specials s where p.products_status = '1' and p.products_id = s.products_id and pd.products_id = s.products_id and pd.language_id = '" . (int)$languages_id . "' and s.status = '1' order by s.specials_date_added desc limit " . MAX_RANDOM_SELECT_SPECIALS)) { bm_whats_new.php if ($random_product = tep_random_select("select products_id, products_image, products_tax_class_id, products_price from " . TABLE_PRODUCTS . " where products_status = '1' order by products_date_added desc limit " . MAX_RANDOM_SELECT_NEW)) { any help would be appreciated
  14. Portman

    call to new function in addon

    thanks @raiwa... that was what I needed to know! Yes I am modifying one of your addons - or at least trying to - at this stage trying to create the ability to hide products from particular wholesale groups
  15. Hi I am using BS Frozen I have been doing some modifications to an add-on and I have created a new <function> to the code to make the add-on operate in the way I need it to... This has worked fine within the files of the add-on.... Now I want to call that function (located in catalog/includes/module/store/st_addon.php) in catalog/product_info.php... Can I do that? and if so how?
×