Jump to content

katapofatico

Members
  • Content count

    63
  • Joined

  • Last visited

  • Days Won

    3

Reputation Activity

  1. Like
    katapofatico reacted to Tsimi in Master Products "Lite" for osC 2.3.4 BS GOLD   
    This is a remake of the original Master Products Addon by Gergely.
    I removed some stuff that I didn't need, like the whole suggested accessories box stuff and the link function to the slave from the master products page.
    This addon is not for those that don't want to change core files, in fact I wouldn't recommend anyone to install this unless it is for testing on a local test shop or maybe
    to improve one day to more modular ways. It requires a lot file changes many which are not modular yet.
    (My special thanks go to @@De Dokta. He knows for what.)
     
    This is all still not fully tested so please make sure all is working for you before intending to install this into a live store.
     
    So here it is, enjoy!
     
     
     
     
  2. Like
    katapofatico reacted to raiwa in Store Mode BS   
    @@katapofatico,
     
    I use it like it is set during installation: 755. Other addons and the core admin protection also write to .htaccess and need this setting, so I think it should be ok.
     
    rgds
    Rainer
  3. Like
    katapofatico got a reaction from raiwa in 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. Like
    katapofatico reacted to burt in Responsive osCommerce - Bootstrap   
    We still have forward movement;
     
    @@BrockleyJohn has fixed up some more files for the new equal heights system;
    https://github.com/gburton/Responsive-osCommerce/commit/a5795569692c1914e4fd034214e4b3751ee30587
     
    Spanish language pack is at 32 out of 34 tasks complete, with work ongoing on the 33rd task;
    https://github.com/gburton/Responsive-osCommerce/issues/480
    Thank you to @@raiwa, @@piernas, @@katapofatico
     
    I have just PR'd superglobals in the Admin https://github.com/gburton/Responsive-osCommerce/pull/503
    This is http_*_vars to _*
  5. Like
    katapofatico reacted to MrPhil in oscommerce "official 2.3.5" version   
    A bug-fix version of 2.3.4, to be called 2.3.5, is supposedly on the way, although nothing seems to have been released yet. Note that this is not responsive and is not a rebadged 2.3.4BS! I would not wait for 2.3.5, but would go to 2.3.4BS Edge instead. At least it's actually out there...
  6. Like
    katapofatico reacted to kymation in Spam addon   
    There is definitely spam in the Addons section. I found two that were pure commercial advertising and another that was malicious code. I reported all of them, and nothing was ever done. You should probably just ignore this one.
     
    Regards
    Jim
  7. Like
    katapofatico reacted to kymation in [Addon} Theme Switcher   
    Instructions for creating and downloading themes are in the Theme Switcher manual, included in the download. The "design it on your store" feature is no longer supported by Themeroller. Unfortunately I can't edit that description to remove the obsolete part.
     
    Regards
    Jim
  8. Like
    katapofatico reacted to Eskil in Payment module development how-to   
    This is a lengthy post. This post is meant for anyone who wants to create/implement their custom payment module. The contents of this post hopefully answers many question anyone has. It is the result of my own acquired understanding of how osCommerce payment modules work. I appreciate any comments if you find this post useful. Please reply to this post if you identify any mistakes in my post or want to elaborate on the topic.
     
    Background:
    I originally replied to a post on how to create a module and received some PMs asking me to elaborate on this.
     
    In this post I will include that same overview with extended explanations and sample code. This post does not attempt to explain how to write a module, as there are many considerations one needs to take and each payment gateway is different. I will outline the standard functions in a module that are required and when and how they are called/used. I assume we are using a gateway which requires a http-post redirect.
     
    First, a simple overview of the standard/required payment module functions (the standard PayPal module or cc module are good references as they implement standard functions and have minimal code):
     
    PAYMENT MODULE STRUCTURE
     


    Function name
    Description
    Calling script
     
    class constructor
    Sets initial member variables and module status (enabled/disabled).
    Define the form_action_url variable which is your gateway url (that will recieve the POST data).
    Include any static variables you may require in your code here.
     
    update_status()
    Here you can implement using payment zones (refer to standard PayPal module as reference).
    Called by module's class constructor, checkout_confirmation.php, checkout_process.php
     
    javascript_validation()
    Here you may define client side javascript that will verify any input fields you use in the payment method selection page. Refer to standard cc module as reference (cc.php).
    Called by checkout_payment.php
     
    selection()
    This function outputs the payment method title/text and if required, the input fields.
    Called by checkout_payment.php
     
    pre_confirmation_check()
    Use this function implement any checks of any conditions after payment method has been selected. You most probably don't need to implement anything here.
    Called by checkout_confirmation.php before any page output.
     
    confirmation()
    Implement any checks or processing on the order information before proceeding to payment confirmation. You most probably don't need to implement anything here.
    Called by checkout_confirmation.php
     
    process_button()
    Outputs the html form hidden elements sent as POST data to the payment gateway.
    Called by checkout_confirmation.php
     
    before_process()
    This is where you will implement any payment verification. This function can be quite complicated to implement. I will elaborate in this later in this post.
    Called by checkout_process.php before order is finalised
     
    after_process()
    Here you may implement any post proessing of the payment/order after the order has been finalised. At this point you now have a reference to the created osCommerce order id and you would typically update any custom database tables you may have for your module. You most probably don't need to implement anything here.
    Called by checkout_process.php after order is finalised
     
    get_error()
    For more advanced error handling. When your module logic returns any errors you will redirect to checkout_payment.php with some error information. When implemented corretly, this function can be used to genereate the proper error texts for particular errors. The redirect must be formatted like this:

    tep_redirect(tep_href_link(FILENAME_CHECKOUT_PAYMENT, 'payment_error=' . $this->code.'&error='.urlencode('some error'), 'NONSSL', true, false));
    I will examplify this in my sample code later in this post (the standard PayPal module does not implement this method).
    Called by checkout_payment.php
     
    check()
    Standard functionlity for osCommerce to see if the module is installed.
     
    install()
    This is where you define module's configurations (displayed in admin).
     
    remove()
    Standard functionality to uninstall the module.
     
    keys()
    This array must include all the configuration setting keys defined in your install() function.
     
    PAYMENT VERIFICATION
     
    A good payment gateway (and payment module) should allow for payment verification. Without any form of payment verification your module is open for url-hacking. This is a very simple consept where a malicious user simply pastes the success url of the e-commerce system (in this case checkout_process.php) and the order is completed assuming the payment has been completed. You can try this by installing the standard PayPal module, completing the order as far as not confirming the order. Then paste in the full url for checkout_process.php for your server.
     
    I will with the following sample code show how to implement payment verification. There are probably numerous ways this may be done. I assume a simple scenario where the payment information is verified by the gateway by re-submitting the data first recieved from the gateway. The information is first checked by the payment module (simple verification) and then re-submitted back the gateway for verification (advanced verification). A result code is passed back to the module. This communication is passed on an underlying layer using secure sockets (SSL) and is invisible to the user (no re-directs). My sample uses cURL to enable underlying connections over SSL.
     
    Note: The module's internal check of the payment data requires to compare the payment amount passed from the gateway with the order amount. To achieve this the $order_totals object must be instantiated from within the module and requires a little hack/work around to be able to complete the order processing: the rest of the code in checkout_process.php from the point where the module's before_process() function is called, must be executed from within this module function. This is related to the chicken&egg problem described here . I have made notes in the sample code where this occurs. (I discovered this problem when tax was added to shipping. The payment amounts would differ.)
     
    Listing 1: usage of before_process() to verify a payment.
     

    function before_process() { global $HTTP_POST_VARS, $cart, $order, $currency, $currencies, $customer_id; // return error if key values are missing if(!isset($HTTP_POST_VARS['PaymentID']) || !isset($HTTP_POST_VARS['OrderID']) || !isset($HTTP_POST_VARS['Amount']) ) tep_redirect(tep_href_link(FILENAME_CHECKOUT_PAYMENT, 'error_message=' . urlencode('No payment information found.'), 'NONSSL', true, false)); $in_paymentID = ''; $in_amount = ''; $in_orderID = ''; $in_currency = ''; // read returned data from gateway $in_paymentID = urldecode($HTTP_POST_VARS['PaymentID']); $in_amount = urldecode($HTTP_POST_VARS['Amount']); $in_orderID = urldecode($HTTP_POST_VARS['OrderID']); $in_currency = urldecode($HTTP_POST_VARS['Currency']); // add PaymentID as comment to order $order->info['comments'] .= "\nPaymentID: ". $in_paymentID; /* From checkout_process.php: create $order_totals object, otherwise $order object will have incorrect data * This is why the rest of checkout_process.php must be included in this function. (see end of function def) * The $order_totalts object needs to be instantiated here and cannot be instantiated twice! */ require(DIR_WS_CLASSES . 'order_total.php'); $order_total_modules = new order_total; $order_totals = $order_total_modules->process(); // Check that values are untampered (simple verification). // Note: get_orderno is an added custom function to generate an orderid as an osc order has no id until it has been completely processed.... if( ($in_amount != number_format($order->info['total'] * $currencies->get_value($currency), $currencies->get_decimal_places($currency), '.', '')) || ($in_orderID != $this->get_orderno($customer_id)) || ($in_currency != $currency) ) ){ tep_redirect(tep_href_link(FILENAME_CHECKOUT_PAYMENT, 'error_message=' . urlencode('Data has been tampered! Payment aborted.'), 'NONSSL', true, false)); } /* Verify transaction with gateway. * The actual verification is defined in a separate function (validate_payment()). * This code assumes using cURL for posting data over SSL. */ $this->validate_payment( $HTTP_POST_VARS ); // Processing continues here if there is no error /* Here we continue the processing that otherwise is done by checkout_process.php. * Include everything in checkout_process starting from line #57 * Alternatively extract that code into an include file (i.e include('module_checkout_process.inc.php'); ) */ include('sample_module_checkout_process.inc.php'); }
     
    Lising 2: The payment validation method

    /* Payment verification * Note that this processing is an example only. All gateways are different. * This function shows how to post data back to the gateway. * * The recieved payment data are posted back to the gateway to verify that they are correct. * Gateway verifies amount, currency, transaction_id and order_id. * Gateway returns 0 for success. * * Also make note of how the errors are handled. * The error information can include your own codes that later are interpreted by the module's get_error() function. */ function validate_payment( $request ){ $postfields = null; foreach($request as $key=>$value){ if($key && $value){ $postfields.=$key."=".urlencode($value)."&"; } } curl_setopt($ch, CURLOPT_URL, 'https://insert.gateway.verification.url.here'); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, $post_data); curl_setopt($ch, CURLOPT_HEADER, 0); // ignore http headers curl_setopt($ch, CURLOPT_TIMEOUT, 10); //returns error 28 curl_setopt($ch, CURLOPT_FAILONERROR, 1); //returns error 22 on HTTP error (http statuscode >= 300) curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 2); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE); // Post data back to gateway $result = curl_exec($ch); // check for error if (curl_errno($ch) != CURLE_OK) { $result['errno'] = curl_errno($ch); $result['errstr'] = curl_error($ch); } curl_close ($ch); // process verification result // if result is array then a CURL error has occurred if(is_array($result) && isset($result['errno'])){ $errornumber = $result['errno']; $errortext = $result['errstr']; $this->luup_debug('Curl or socket error: ', $errornumber . ' ' . $errortext); switch($errornumber){ case CURLE_HTTP_RETURNED_ERROR: // HTTP error tep_redirect(tep_href_link(FILENAME_CHECKOUT_PAYMENT, 'payment_error=' . $this->code.'&error='.urlencode($errortext), 'NONSSL', true, false)); break; case CURLE_OPERATION_TIMEOUTED: tep_redirect(tep_href_link(FILENAME_CHECKOUT_PAYMENT, 'payment_error=' . $this->code.'&error='.urlencode('TIMEOUT'), 'NONSSL', true, false)); break; case 0: // connection failure tep_redirect(tep_href_link(FILENAME_CHECKOUT_PAYMENT, 'payment_error=' . $this->code.'&error='.urlencode('CONNECT_FAIL'), 'NONSSL', true, false)); break; default: // curl/socket error tep_redirect(tep_href_link(FILENAME_CHECKOUT_PAYMENT, 'payment_error=' . $this->code.'&error='.urlencode($errornumber.': '.$errortext), 'NONSSL', true, false)); break; } } else{ // is the payment verified? if($result != '0'){ // payment is not ok tep_redirect(tep_href_link(FILENAME_CHECKOUT_PAYMENT, 'payment_error='.$this->code.'&error='.urlencode($result), 'NONSSL', true, false)); } // payment is ok return true; }
     
    Listing 3: Formatting errors

    // displays/formats error function get_error() { global $HTTP_GET_VARS, $language; // ensure we have all texts defined require_once(DIR_WS_LANGUAGES . $language . '/modules/payment/'.$this->code.'.php'); $error = ''; $error_text['title'] = MODULE_PAYMENT_SAMPLE_TEXT_ERROR_TITLE; if(isset($HTTP_GET_VARS['error'])) $error = urldecode($HTTP_GET_VARS['error']); // otherwise default error is displayed switch($error){ case 'TIMEOUT': $error_text['error'] = MODULE_PAYMENT_SAMPLE_TEXT_ERROR_TIMEOUT; break; case 'CONNECT_FAIL': $error_text['error'] = MODULE_PAYMENT_LUUP_SAMPLE_ERROR_CONNECT_FAIL; break; /* include additional handling for gateway specific errors here */ default: //other error $error_text['error'] = MODULE_PAYMENT_SAMPLE_TEXT_ERROR_UNKNOWN ." ($error)"; break; } return $error_text; }
     
    Developing a payment module may be a complicated and time-consuming task. I hope this post helps you to understand how the payment process works and how the payment module's functions are used - and in the end makes it easier for you to write your own custom payment module. :thumbsup:
     
    Eskil
  9. Like
    katapofatico reacted to Tsimi in Discount Code BS   
    Here is a BETA package that contains a couple of code improvements provided by @@katapofatico and the new discount on shipping feature provided by @@raiwa and @@greasemonkey. I need some guys to test this before it can be cleaned and uploaded as new update to the addons area.
     
     
     
     
     
    *Please do not use this in a live store yet, this package is not final and contains a lot uncleaned code.
  10. Like
    katapofatico got a reaction from Tsimi in Discount Code BS   
    @@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.
  11. Like
    katapofatico reacted to piernas in Header Module - debug breakpoints   
    I'm fine-tuning columns and stuff in a 2.3.4 responsive new install and needed to know what bootstrap 3 breakpoint I'm using on each device, so I made this module. It adds a <div> on header that states if we're seeing -xs, -sm, -md, -lg or -xl screen setup. I've also added a new -ms breakpoint as noted here (a really amazing fix  bor bootstrap 3 I highly recommend): http://forums.oscommerce.com/topic/408594-bootstrap-min-width-480px-and-max-width-768px-fix-the-frustration/
     
    Obviously this module is intended to be used only when debugging, not on a live shop.
  12. Like
    katapofatico reacted to mattjt83 in Problem: Header Tag Module including multiple Javascript files   
    @@katapofatico
     
    You can paste your modules code here so we can look at it but you could also do something like....
    $output = '<script type="text/javascript" src="ext/modules/validation/jquery.validate.min.js" />'; $output .= '<script type="text/javascript" src="ext/modules/validation/localization/messages_es.min.js" />'; $oscTemplate->addBlock($output, $this->group); Also make sure inside your function you include
    global $oscTemplate;
  13. Like
    katapofatico got a reaction from Tsimi in Discount Code BS   
    @@Tsimi I have uploaded my header tag module here: http://addons.oscommerce.com/info/9470
  14. Like
    katapofatico reacted to kymation in [Addon] Modular Product Page (Bootstrap)   
    So the Limit 1 would make the query faster by stopping after it finds the first match. That would be worth doing for cases where that table is very large. Good point!
     
    The latest version does not call tep_get_products_special_price(), it does the database call directly. This is probably a good place to add a Limit 1 as well. I could probably improve this slightly by using a temporary variable. I also suspect that the improvement would be impossible to detect on a modern server. Oh well, best practices and all that.
     
    Thanks for the suggestions.
     
    Regards
    Jim
  15. Like
    katapofatico reacted to 14steve14 in [Addon] Modular Product Page (Bootstrap)   
    Jim
     
    You are one of only a few coders that have finally embraced the whole concept of the bootstrap version and are trying to reduce core code changes, and make the whole system modular. Congratulations, the work you are doing must be helping to move the BS version of oscommerce forward. Thank you for the great work.
     
    I have added both the modular product and index pages to my test store and they seem to work very well. Hopefully others will produce even more modules and ideas to enhance what is already available.
  16. Like
    katapofatico reacted to piernas in Addon Development - Best Practices   
    Found that there is a mechanism already existing on admin that allows modules to show its version number (a public property called version) or API version but only seen this in action in the new paypal app and in some modules newly made by @kyrmation.
    With the growing quantity of modules I think it would be nice if that feature gets into all the new modules as a best practice to allow an easier version control and a future way to check for updates from the web (like the mechanism in the header tags SEO contribution made by @@Jack_mcs).
  17. Like
    katapofatico reacted to kymation in [Addon] Modular Navigation Bar (Bootstrap)   
    I've uploaded a new version of the base Modular Navigation Bar Addon. Thanks to @@katapofatico for spotting one of my typos. I think I've fixed everything now, but please post here if you find any more. As always, bug reports are welcome.
     
    Regards
    Jim
  18. Like
    katapofatico got a reaction from Tsimi in Horizontal Categories Menu BS   
    I've founded that it's better to declare $result before the if: in other case, if the if results false, the final sentence return $result; throws again a PHP Notice:  Undefined variable.
    Then:
    function _buildHoz($parent_id, $level = 0) { $result = ''; // this line added if (isset($this->_data[$parent_id])) {
  19. Like
    katapofatico reacted to chrishamblin in Responsive osCommerce - Bootstrap   
    Well, I did it.
     
    There's a PDF here:
    http://ftp2.sundance.com/Pub/temp/How%20to%20install%20oscommerce%20BS3.pdf
     
    and the doc here:
    http://ftp2.sundance.com/Pub/temp/How%20to%20install%20oscommerce%20BS3.doc
     
    When I went through the install of the Edge version a few days ago, I'm sure that before I was asked for a name for what I wanted the Admin directory to be changed to, but when I ran though it for this documentation, I wasn't asked.
     
    Is that a server setting, or something that I just imagined?
     
    Also, the final page of the EDGE install doesn't mention stuff like deleting the install directory, changing the permissions of the config files etc.
     
    I hope this help someone.
     
    Chris
  20. Like
    katapofatico reacted to burt in Responsive osCommerce - Bootstrap   
    And for future askers of the same question:  read the README.md file, paying particular attention to the "installation" part.
  21. Like
    katapofatico got a reaction from raiwa in SPPC Lite   
    I think you can improve this code mantaining data coherence between original $cart and your shoppingCartMod variables using references:
    public function __construct() { global $cart, $customer_id; $this->contents = &$cart->contents; $this->total = &$cart->total; $this->weight = &$cart->weight; $this->cartID = &$cart->cartID; $this->content_type = &$cart->content_type; $this->product_id_list = &$cart->product_id_list; } You can think that it does not matter, because all $cart uses refers to you $shoppingCartMod instance: you control the system. But two replies:
    Another extension can take pararell control, out of your controll You save RAM. I'm not an expert on PHP memory management, I come from Java, where references are very useful to save memory. I have not tested it in your module, I have tested it in my order extension (inspired by you ;) ) and it works with these benefits.
  22. Like
    katapofatico reacted to piernas in How to extend order class   
    I've faced the same problem with orders class and did not find a good solution, so I ended up modifying the class itself. Will follow this topic in the hope someone sheds light on the problem!
  23. Like
    katapofatico got a reaction from piernas in New admin hook system   
    related post: Can we get a tutorial on hooks?
  24. Like
    katapofatico reacted to raiwa in How to extend order class   
    @@katapofatico,
     
    You can check this example for a chopping_cart extension:
    http://forums.oscommerce.com/topic/408481-sppc-lite/?p=1734997
     
     
    and if you download the following add-on you can find a more simple example for a currency extension:
    http://addons.oscommerce.com/info/9365
     
    the class extension is included and called in the store module: includes/modules/store/st_tax_below_price.php
    $currencies = new currencies_mod(); and the extension class at the end:
    if (class_exists('currencies')) { class currencies_mod extends currencies { // add tax below price mod public function format($number, $calculate_currency_value = true, $currency_type = '', $currency_value = '', $products_tax = '', $show_tax_info = true) { ...................... hope this helps
     
    regards
    Rainer
  25. Like
    katapofatico reacted to allaboutwicker in What extra contributions does OSC 2.3.4 bootstrap need?   
    I also was wonder which SEO addons I should try as I see several that look similar. These are the ones I was thinking to use for my 2.3.4 BS site:
     
    Google Sitemap SEO - http://addons.oscommerce.com/info/7789
     
    SEO Header Tags Reloaded - http://addons.oscommerce.com/info/8864
     
    Ultimate SEO URLs - http://addons.oscommerce.com/info/2823  <---- This shows for 2.2, but appears by comments will work with 2.3.4 ???
     
    Does anyone know if they are compatible or have others that they would suggest instead?
     
    Thanks for any input!
×