Jump to content

katapofatico

Members
  • Content count

    63
  • Joined

  • Last visited

  • Days Won

    3

Everything posted by katapofatico

  1. @piernas Did you finished and published your module? I'm looking for something like it. :) Thanks!
  2. katapofatico

    Store Mode BS

    PHP Warning: file_put_contents(../maintenance.php): failed to open stream: Forbidden access in ...includes/modules/header_tags_amantis/ht_store_mode.php on line 166 Ok, I know it's a permissions problem. But I've never known what level of permissions to grant on this situations :( What's the minimum (most conservative and secure) chmod numbers to allow writting .htaccess from ht_store_mode.php? Can you guide me please? Thanks!
  3. katapofatico

    Store Mode BS

    @@raiwa Installing the content module, on URL ...admin/modules.php?set=header_tags&module=ht_store_mode Notice: Use of undefined constant MODULE_HEADER_TAGS_STORE_MODE_MESSAGE_ - assumed 'MODULE_HEADER_TAGS_STORE_MODE_MESSAGE_' in .../includes/modules/header_tags/ht_store_mode.php on line 201 $KeysArray[] = MODULE_HEADER_TAGS_STORE_MODE_MESSAGE_ . $key; Fixed: $KeysArray[] = 'MODULE_HEADER_TAGS_STORE_MODE_MESSAGE_' . $key;
  4. Thanks, Dan and Phill :) I have not a good idea about the branches development status and meaning: I work only on gBurton/oscBS and the parent projects are a mistery to me (I miss a simple diagram explaining it). Therefore, thanks @@Dan Cole for your link to 2.3 branch: I will post my commit there.
  5. @@burt mentioned oscommerce "official 2.3.5" version here, but I don't find any information about it. Anybody can guide me to it? Any link? Thanks!
  6. katapofatico

    Spam addon

    There's a fake addon: http://addons.oscommerce.com/info/9501 Is there any control about it?
  7. katapofatico

    Spam addon

    Excuse me, it looks a simple developer confusion. The addon is correct, only the last file is a mistake.
  8. katapofatico

    [Addon} Theme Switcher

    The addon description says: Instructions are included for using the ThemeRoller tool to download stock themes and design new ones. It includes a method that allows you to design WYSIWYG on your own store pages @@kymation Please, where can we see these features?
  9. katapofatico

    [Addon} Theme Switcher

    There's a new file on addons site, uploaded by @@beauty_Bar, versioned as theme_switcher_1.5.3_1 but it hasn't any differences to previous version theme_switcher_1.5.3 by @@kymation. Maybe an error?
  10. I'm developing a header tag module in order to include jquery validation plugin. I use Firefox browser. My first attempt works well ... private function _includeValidation() { $oscTemplate->addBlock('<script type="text/javascript" src="ext/modules/validation/jquery.validate.min.js" />', $this->group); // $this->group = 'header_tags' } ... but when I try to include another script... private function _includeValidation() { $oscTemplate->addBlock('<script type="text/javascript" src="ext/modules/validation/jquery.validate.min.js" />', $this->group); $oscTemplate->addBlock('<script type="text/javascript" src="ext/modules/validation/localization/messages_es.min.js" />', $this->group); } ... the browser only load the first one: jquery.validate.min.js ATTEMPTS 1) If I switch the loading order... private function _includeValidation() { $oscTemplate->addBlock('<script type="text/javascript" src="ext/modules/validation/localization/messages_es.min.js" />', $this->group); $oscTemplate->addBlock('<script type="text/javascript" src="ext/modules/validation/jquery.validate.min.js" />', $this->group); } ... the browser only load the first one: messages_es.min.js 2) I see that core modules sometimes include a breakline separator, then I try applying it... private function _includeValidation() { $oscTemplate->addBlock('<script type="text/javascript" src="ext/modules/validation/jquery.validate.min.js" />' . PHP_EOL, $this->group); $oscTemplate->addBlock('<script type="text/javascript" src="ext/modules/validation/localization/messages_es.min.js" />' . PHP_EOL, $this->group); } ... the browser only load the first one: jquery.validate.min.js 3) Using "\n" instead of PHP_EOL, as other modules... private function _includeValidation() { $oscTemplate->addBlock('<script type="text/javascript" src="ext/modules/validation/jquery.validate.min.js" />' . "\n", $this->group); $oscTemplate->addBlock('<script type="text/javascript" src="ext/modules/validation/localization/messages_es.min.js" />' . "\n", $this->group); } ... the browser only load the first one: jquery.validate.min.js 4) Importing another JS file: private function _includeValidation() { $oscTemplate->addBlock('<script type="text/javascript" src="ext/modules/validation/jquery.validate.min.js" />', $this->group); $oscTemplate->addBlock('<script type="text/javascript" src="ext/modules/jquery.scrollTo.min.js" />', $this->group); } ... the browser only load the first one: jquery.validate.min.js 5) Using the jquery version associated to the query Validation 1.15. I disabled jquery import on template_top and then ... private function _includeValidation() { $oscTemplate->addBlock('<script type="text/javascript" src="ext/modules/validation/lib/jquery.js" />', $this->group); $oscTemplate->addBlock('<script type="text/javascript" src="ext/modules/validation/jquery.validate.min.js" />', $this->group); } ... the browser only load the first one: jquery.js 6) Import each JS file from distinct modules: 6.A ) Importing jquery.validate.min.js on ht_noscript.php core module... function execute() { global $oscTemplate; $oscTemplate->addBlock('<noscript><div class="no-script"><div class="no-script-inner">' . tep_output_string(MODULE_HEADER_TAGS_NOSCRIPT_TEXT) . '</div></div></noscript>', $this->group); $oscTemplate->addBlock('<style>.no-script { border: 1px solid #ddd; border-width: 0 0 1px; background: #ffff90; font: 14px verdana; line-height: 2; text-align: center; color: #2f2f2f; } .no-script .no-script-inner { margin: 0 auto; padding: 5px; } .no-script p { margin: 0; }</style>', $this->group); // My hack: $oscTemplate->addBlock('<script type="text/javascript" src="amantis/ext/modules/validation/jquery.validate.min.js" />', $this->group); } 6.B ) ... and importing validation language file on my module: private function _includeValidation() { $oscTemplate->addBlock('<script type="text/javascript" src="ext/modules/validation/localization/messages_es.min.js" />', $this->group); } ... ¡and this works! Experiments lead to me to consider that the problem is in my header tag module file, but it's made from another core header tag module, and it's simple... Has anyone encountered anything like this? Any clue, path will be so appreciated: I'm very frustrated, hours debugging :( Thanks! :pray:
  11. @@burt I don't know if is convenient to tag this as "solved" or something like this.
  12. Thanks @@mattjt83 for your attempts and @@burt for the solution: it's was my fault: simply bad markup of <script> element!. Thanks! :thumbsup:
  13. This is not the problem: current page is correctly detected, the first import works. Thanks anyway :) Yes, I have been playing with this variable, and the problem continue :(
  14. @@mattjt83 Thanks for help: I didn't check your idea!... but it doesn't works :( My code whith your idea is here: <?php class ht_template_top_general { var $code = 'ht_template_top_general'; var $group = 'header_tags'; var $title; var $description; var $sort_order; var $enabled = false; function ht_template_top_general() { $this->title = MODULE_HEADER_TAGS_TEMPLATE_TOP_GENERAL_TITLE; $this->description = MODULE_HEADER_TAGS_TEMPLATE_TOP_GENERAL_DESCRIPTION; if (defined('MODULE_HEADER_TAGS_TEMPLATE_TOP_GENERAL_STATUS')) { $this->sort_order = MODULE_HEADER_TAGS_TEMPLATE_TOP_GENERAL_SORT_ORDER; $this->enabled = (MODULE_HEADER_TAGS_TEMPLATE_TOP_GENERAL_STATUS == 'True'); } } function execute() { global $PHP_SELF, $oscTemplate; switch ($PHP_SELF) { case FILENAME_CHECKOUT_SHIPPING_ADDRESS: { $validationJs = '<script type="text/javascript" src="amantis/ext/modules/validation/jquery.validate.min.js" />'; $validationJs .= '<script type="text/javascript" src="amantis/ext/modules/validation/localization/messages_es.min.js" />'; $oscTemplate->addBlock($validationJs, $this->group); } } } function isEnabled() { return $this->enabled; } function check() { return defined('MODULE_HEADER_TAGS_TEMPLATE_TOP_GENERAL_STATUS'); } function install() { tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Ajustes generales de Amantis sobre la plantilla', 'MODULE_HEADER_TAGS_TEMPLATE_TOP_GENERAL_STATUS', 'True', 'Ajustes generales de Amantis sobre la plantilla', '6', '1', 'tep_cfg_select_option(array(\'True\', \'False\'), ', now())"); tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Sort Order', 'MODULE_HEADER_TAGS_TEMPLATE_TOP_GENERAL_SORT_ORDER', '0', 'Sort order of display. Lowest is displayed first.', '6', '0', now())"); } function remove() { tep_db_query("delete from " . TABLE_CONFIGURATION . " where configuration_key in ('" . implode("', '", $this->keys()) . "')"); } function keys() { return array('MODULE_HEADER_TAGS_TEMPLATE_TOP_GENERAL_STATUS', 'MODULE_HEADER_TAGS_TEMPLATE_TOP_GENERAL_SORT_ORDER'); } }
  15. @@Tsimi I have uploaded my header tag module here: http://addons.oscommerce.com/info/9470
  16. @@Tsimi More improvements, this time in order to avoid code changes: A ) Instead of write on admin/template_top.php, you can add these lines on admin/discount_codes.php, before applies_to_onclick() definition: $(document).ready(function() { if (<?php echo ((basename($PHP_SELF) == 'discount_codes.php' && isset($action) && $action == 'new') ? 'true' : 'false')?>) { onload(); } }); B ) Instead of modify checkout_payment.php, you can use a header_tag module that inject HTML and javascript. I have the module files but... I can't attach to this post! Anybody can show me how? C) Instead of modify 11 lines on checkout_process.php and 7 on application_top, you can use hook callings and write only 1 or 2 lines.
  17. Another improvement: Saving a new discount code from admin, can throw messages on error.log as these ones: PHP Notice: Undefined index: exclude_specials in /opt/lampp/htdocs/fenix/amantis/amantis-fenix.4/admin/discount_codes.php on line 36 PHP Notice: Undefined index: excluded_products_id in /opt/lampp/htdocs/fenix/amantis/amantis-fenix.4/admin/discount_codes.php on line 69 These fields can be disabled on the form, therefore there are not present on $_POST. This fix it: after: case 'insert': if (!empty($HTTP_POST_VARS['discount_codes']) && !empty($HTTP_POST_VARS['discount_values'])) { add: $exclude_specials = isset($HTTP_POST_VARS['exclude_specials']) ? (int) $HTTP_POST_VARS['exclude_specials'] : 0; and use $exclude_specials to create $sql_data_array: 'exclude_specials' => $exclude_specials, Other hand, replace this: if (is_array($HTTP_POST_VARS['excluded_products_id']) && sizeof($HTTP_POST_VARS['excluded_products_id']) > 0) { whith this: if (isset($HTTP_POST_VARS['excluded_products_id']) && is_array($HTTP_POST_VARS['excluded_products_id']) && sizeof($HTTP_POST_VARS['excluded_products_id']) > 0) { Notes: a ) Surely the last fix should be applied to other $_POST inspections: $HTTP_POST_VARS['categories_id'], $HTTP_POST_VARS['manufacturers_id'], etc. b ) Maybe you want to implement the getting of $HTTP_POST_VARS['exclude_specials'] not where I said (before $sql_data_array creation), but on next lines, where tou perform the other checkings and add fields to $sql_data_array, one by one.
  18. @@Tsimi On a installation without Modular Shopping Cart... When I load checkout_payment.php, error.log says: PHP Notice: Use of undefined constant MODULE_ORDER_TOTAL_DISCOUNT_TITLE - assumed 'MODULE_ORDER_TOTAL_DISCOUNT_TITLE' in .../includes/modules/order_total/ot_discount.php on line 28, referer: http://localhost/.../checkout_payment.php It can be fixed on discount_code.php, before include(DIR_WS_MODULES . 'order_total/ot_discount.php'); add: include(DIR_WS_LANGUAGES . $language . '/modules/order_total/ot_discount.php');
  19. katapofatico

    [Addon] Modular Product Page (Bootstrap)

    Yeah! That is the key Excuse me, but are you reffering to a new version not yet published, aren't you? Because version 1.1 (http://addons.oscommerce.com/info/9453) from 5/April/2016 calls to tep_get_products_special_price(). Yes, I always implement OOP and general best practices: I wonder when somebody ask for reasons, advantages, justifications, etc. about it. I think best prastices have a lot of benefits to performance, reusability, manteinability, etc.: Predictable and not predictable benefits. My criteria is: First I implement them, later I suspect about them: not the reverse: First suspect, later implement them. Best practices and design patterns are more inteligent that me, because they are historically condensed programming experiences. I like that you like it ;)
  20. katapofatico

    [Addon] Modular Product Page (Bootstrap)

    Ok, the core PHP code is avoiding duplicated product_id on specials table, but no specials table himself: in this situations I use LIMIT 1 or I define the DBB field as UNIQUE. I want to avoid full scanning of tables... I don't know specifically if this problem occurs with this query :) I don't see caching improvements on http://addons.oscommerce.com/info/9453 : public function special_price() { return tep_get_products_special_price($this->product_info['products_id']); } ...therefore on cm_pi_price.php we will query 3 times on a product with special price: if ($product_info->has_special_price() === true) { // THIS CALL TO products_price() // HERE 2 CALLS MORE: $products_price = '<del>' . $currencies->display_price( $product_info->products_price(), tep_get_tax_rate( $product_info->products_tax_class_id() )) . '</del> <span class="productSpecialPrice" itemprop="price" content="' . preg_replace('/[^0-9.]*/', '', $currencies->display_price($new_price, tep_get_tax_rate($product_info->products_tax_class_id() ))) . '">' . $currencies->display_price($new_price, tep_get_tax_rate($product_info->products_tax_class_id() )) . '</span>'; } else { [...]
  21. katapofatico

    [Addon] Modular Product Page (Bootstrap)

    @@kymation @@burt I'm worried because if we implement this module we will break away from core improvements on product_info.php. @@burt What do you think about integrating this module on master branch?
  22. katapofatico

    [Addon] Modular Product Page (Bootstrap)

    @@kymation ok, then: a ) use your inner query b ) and cache the result (avoiding unnecessary queries) in instance attribute $new_price c ) I have added LIMIT 1 because products_id is not PRIMARY_KEY nor UNIQUE, only INDEX. What do you think about this? public function special_price() { if ($this->new_price === null) { $special_price_query_raw = " select specials_new_products_price from " . TABLE_SPECIALS . " where products_id = '" . $this->products_id . "' and status = 1 LIMIT 1"; $special_price_query = tep_db_query($special_price_query_raw ); $special_price_array = tep_db_fetch_array( $special_price_query ); $this->new_price = $special_price_array['specials_new_products_price']; } return $this->new_price; }
  23. katapofatico

    [Addon] Modular Product Page (Bootstrap)

    Hello, While I'm developing I active this: error_reporting(E_ALL); ...and the product_info.php of a product with special price throws: Notice: Undefined variable: new_price in [...]includes/modules/content/product_info/cm_pi_price.php on line 41 The line is: $products_price = '<del>' . $currencies->display_price( $product_info->products_price(), tep_get_tax_rate( $product_info->products_tax_class_id() )) . '</del> <span class="productSpecialPrice" itemprop="price" content="' . preg_replace('/[^0-9.]*/', '', $currencies->display_price($new_price, tep_get_tax_rate($product_info->products_tax_class_id() ))) . '">' . $currencies->display_price($new_price, tep_get_tax_rate($product_info->products_tax_class_id() )) . '</span>'; Replacing $new_price with $product_info->special_price() solves it. For performance, I suggest this change on product_info class, using the unused class public variable $new_price: public function special_price() { if ($this->new_price === null) { $this->new_price = tep_get_products_special_price($this->product_info['products_id']); } return $this->new_price; } Thanks a lot for your usefull module!
  24. I never understood the meaning and purpose of the quote() function parameters on shipping.php class: class shipping { (...) function quote($method = '', $module = '') { neither the sub-uses on shipping modules, for example: class usps { function quote($method = '') { Ok, in this example I can see using of $method parm: if (($method == '' && in_array($type, $this->types)) || $method == $type) { if (strpos($type, "Flat Rate")) $type_flat = $type . ', subject to verification'; else $type_flat = $type; $methods[] = array('id' => $type, 'title' => $type_flat, 'cost' => ($cost + MODULE_SHIPPING_USPS_HANDLING) * $shipping_num_boxes); } But, excuse me, I can't imagine the meaning. Can anybody explain us what's the meaning and when is useful to use it? Thanks a lot, seriously: your answer can alleviat a dude in my mind from several years ago! (excuse my English) :D
  25. katapofatico

    [Addon] Modular Navigation Bar (Bootstrap)

    On includes/modules/content/navbar/templates/cm_nb_cart.php line 23 there is a typing error: <li><a href="' . tep_href_link(FILENAME_SHOPPING_CART) . '">' . HEADER_CART_VIEW_CART . '</a></li> solution: <li><a href="'<?php echo tep_href_link(FILENAME_SHOPPING_CART) . '">' . HEADER_CART_VIEW_CART ?></a></li>
×