Jump to content

ecartz

♥Ambassador
  • Content count

    3,864
  • Joined

  • Last visited

  • Days Won

    69

Posts posted by ecartz


  1. You might want to change lines 67-71 to

          $tpl_data = ['group' => $this->group, 'file' => __FILE__];
          include 'includes/modules/block_template.php';

    Which happens to be robust in the face of name changes as well as forwardly compatible with switchable templates.  See https://github.com/gburton/CE-Phoenix/commit/e8280d9fdf6364c01484fb5f292adf2511bcefbb#diff-da2a69f7f229fdc1ad483c93b286d7f2 for examples. 


  2. Create a checkout_shipping, injectRedirects hook. 

    public function listen_injectRedirects() {
      $GLOBALS['products_ship_free'] = false;
      if (!GLOBALS['free_shipping']) {
        define('TEXT_CHOOSE_SHIPPING_METHOD', TEXT_CHOOSE_SHIPPING_METHOD_NO_PFS);
        define('TEXT_ENTER_SHIPPING_INFORMATION', TEXT_ENTER_SHIPPING_INFORMATION_NO_PFS);
        return;
      }
    
      foreach ($_SESSION['cart']->get_products() as $product) {
        if (1 == $product['ship_free']) {
          $ship_free_count += $product['quantity'];
        }
      }
    
      if (($GLOBALS['total_weight'] == 0) && ($GLOBALS['total_count'] == 0)) {
        $products_ship_free = true;
        $GLOBALS['free_shipping'] = true;
        if (!defined('FREE_SHIPPING_TITLE')) {
          include 'includes/languages/' . $_SESSION['language'] . '/modules/order_total/ot_shipping.php';
        }
      }
    
      define('TEXT_CHOOSE_SHIPPING_METHOD', ($products_ship_free ? sprintf(PRODUCTS_SHIP_FREE_COUNT, $ship_free_count); : TEXT_CHOOSE_SHIPPING_METHOD_NO_PFS));
      define('TEXT_ENTER_SHIPPING_INFORMATION', ((!$products_ship_free && ($ship_free_count > 0)) ? sprintf(PRODUCTS_SHIP_FREE_COUNT_ONLY, $ship_free_count) : TEXT_ENTER_SHIPPING_INFORMATION_NO_PFS));
    }

    or similar.  In the language files for that page, for each language, change TEXT_CHOOSE_SHIPPING_METHOD to TEXT_CHOOSE_SHIPPING_METHOD_NO_PFS and TEXT_ENTER_SHIPPING_INFORMATION to TEXT_ENTER_SHIPPING_INFORMATION_NO_PFS. 

    In your overridden shopping_cart class, also change

        function count_contents() {
          $total_items = 0;
          if (is_array($this->contents)) {
            foreach (array_keys($this->contents) as $products_id) {
              $total_items += $this->get_quantity($products_id);
            }
          }
    
          return $total_items;
        }

    to

        function count_contents() {
          $total_items = 0;
          if (is_array($this->contents)) {
            foreach ($this->contents as $products_id => $product) {
              if (1 != $product['ship_free']) {
                $total_items += $this->get_quantity($products_id);
              }
            }
          }
    
          return $total_items;
        }

    and change in the calculate function

              $this->weight += ($qty * $products_weight);

    to

              if (1 != $this->contents[$products_id]['ship_free']) {
                $this->weight += ($qty * $products_weight);
              }

    That should cover the checkout_shipping instructions Lambros posted.  There may be other changes necessary to other files that are not included here.  For example, there are other changes to the shopping_cart class posted in the instructions.  And the catalog/shopping_cart.php change would now be made in includes/modules/content/shopping_cart/templates/tpl_cm_sc_product_listing.php

    Replace

        echo   '<th><a href="' . tep_href_link('product_info.php', 'products_id=' . $product['id']) . '">' . $product['name'] . '</a>';
        foreach (($product['attributes'] ?? []) as $option => $value) {

    with

        echo   '<th><a href="' . tep_href_link('product_info.php', 'products_id=' . $product['id']) . '">' . $product['name'] . '</a>';
        if (1 == $product['ship_free']) {
          echo '<br /><span class="smallText">(' . TEXT_PRODUCT_SHIPS_FREE . ')</span>';
        }
        foreach (($product['attributes'] ?? []) as $option => $value) {

    That's three lines added between two existing lines. 

    Hopefully that will be enough to get you going.  @Omar_one


  3. I can see your previous threads: 

    But please note that none of these do what Jack suggested.  Which is to find the existing thread for the particular App that you are using and post in that existing thread.  You keep posting new threads.  I can't even tell just by reading what App you have tried.  You posted a name but I'd have to search to see if I could find it. 

    You seem to be confusing a forum with a thread.  This is the Order Total module forum.  It is where developers go to post support threads for Apps.  It's not really intended for users to post question threads.  And in general, your threads aren't asking the kind of questions that people can help you.  I've read them.  I don't know the answer to the questions you are asking.  The only person who might know is the developer who made the App.  If the developer has not responded to you so far, then it is quite likely that that person is not reading the forum actively.  Posting in the actual support thread might notify that person. 

    It's also possible that the App is not actively supported.  It might need a new developer to take it over or to code a new one.  To interest such a developer, you would have to pay that person.  Because there aren't roving developers just waiting around to do free work. 

    Alternately, if you are actively trying to code something yourself, you could show us what you tried, what you thought/hoped would happen, and what actually did happen.  Then ask for help making it work the way that you wanted.  But as is, your question basically comes down to you wanting to do something and asking us to figure out how to do it for you.  And frankly, I'm far too lazy to do that.  In general, if your question requires us to find and download an App (or two) just to figure out what you're actually asking, it's unlikely that anyone will try to answer it. 


  4. 29 minutes ago, LuckyPiedro said:

    What I don't understand is that because of this change, an extra check on "is_string ($ payment)", there is no PHP message anymore.

    The message says, "invalid offset".  A string is (by definition) a valid offset.  So what the message is telling you is that $payment is not a string (nor a  number).  With the check, it no longer gets to the point where it tries to use $payment as an array offset.  Because if it's not a string, PHP doesn't bother checking the rest of the expression.  This is called short circuit evaluation. 


  5. is_object($GLOBALS[$payment])

    That checks to see if there is a global object named $$payment.  If it was checking for a global object named $payment, it would say

    is_object($GLOBALS['payment'])

    The warning is saying that $payment, which should be a string, is instead an object.  Because an object is not a valid array index key (in PHP), it complains when it attempts to dereference $GLOBALS (an array) with it.  Where dereference is just a fancy word for doing $GLOBALS[$payment].  Meaning to find the entry in $GLOBALS for the key $payment. 

    It's also possible that the code is going down a weird path when there is an error.  It seems like something is doing

    $payment = new payment();

    while $payment is bound to the session value.  If this is a bug in 1.0.4.0, it won't get fixed now, as we've moved on to 1.0.6.0.  So any fixes would occur in 1.0.6.1 or later. 


  6. __ PHP_Incomplete_Class is what happens when the session is loaded before the class. 

    This should not happen if you use a version of Phoenix with the autoloader and the payment module is in includes/modules/payment.  So one solution would be to update from 1.0.4.0 to 1.0.5.0 or 1.0.6.0.  That should get rid of the __ PHP_Incomplete_Class. 

    Another issue though is that $payment should be a string, not an object.  $$payment should be the object.  So it is likely that there is a bug in the module where it sets $payment equal to something where it should have set $$payment (or $GLOBALS[$_SESSION['payment']]) to something. 


  7. 15 minutes ago, Patty said:

    Call to a member function fetch_to_address() on null

    It looks like it needs to have the $customer object created. 

    $customer = new customer($customer_id);

    You may have to find a way to make it work with a fake customer ID when the customer is not logged in.  Possibly would require shipto and billto to be stored in the session (as arrays of information). 


  8. 29 minutes ago, undersiege said:

    - i think i don't understand what exactly i have to keep synch with what

    You want the username/password that you set in your host server panel to be the same as the username/password set in the store admin.  Because when you authenticate through the host method, it will try to apply the same username/password to the store admin.  If they are set the same in both places, it will log you in.  If not, you have to log in twice.  Once with each credentials. 

    32 minutes ago, undersiege said:

    - it doens't stay on 444, i changed it and look after it comes back to 644

    Then you are on the second part of the advice:  "contact your host to do it for you" since they won't let you do it yourself. 


  9. 2 hours ago, undersiege said:

    But i just do the password folder security on my host serveur panel. Is it ok like that ?

    Yes.  It's safer for the files not to be writable.  But then you have to manually keep them in synch. 

    2 hours ago, undersiege said:

    i've puted the file on 644 but the message remain. Maybe another thing that i missunderstood.. needs help for this tto please

    Try 444. 


  10. 7 hours ago, tony34567 said:

    [Mon Apr 06 01:49:38 2020] [error] [client xx.xx.xx.xx] PHP Fatal error:  require(): Failed opening required 'DIR_WS_INCLUDEStemplate_top.php' (include_path='.:/usr/share/php:/usr/share/pear') in /var/www/vhosts/mywebsite/mywebsite.co.uk/httpdocs/admin/modules_hooks.php on line 17, referer: http://mywebsite.co.uk/admin/administrators.php

    This error says that your module_hooks page is trying to use a DIR_WS_INCLUDES constant that has not been defined. 

    You could try adding

    define('DIR_WS_INCLUDES', 'includes/');

    At the top of the module_hooks.php page (even before it includes application_top.php but anywhere before template_top.php would probably do).  Of course, that might just get it to the next error. 


  11. 1 hour ago, NateNg said:

    I just installed the new KissIT image thumbnailer 3.2.1  and I got this error. Please advise. 

    AH01071: Got error 'PHP message: PHP Fatal error:  Uncaught Error: Class 'abstract_executable_module' not found in /home/xxx/xxx/xxxxxxx/xxx/xxxx/includes/modules/content/product_info/cm_pi_gallery_kissit.php:13\nStack trace:\n#0 

    Are you running OSCOM CE Phoenix 1.0.5.1 or later?  If not, you should probably use the older version. 


  12. 15 minutes ago, artfulweb said:

    In fact, tpl_n_checkout.php is only called for the extra order email which is not in HTML format so the above changes blitzes the products in the email to the owner.

    The two aren't separate that way.  A more correct way to put it would be that the output from tpl_n_checkout.php is only used by the extra order email.  To fix that, you can add

    echo $products_ordered;

    either before or after the

    //------insert customer chosen option eof ----

     


  13. From where you are, the easiest way would probably be to change line 28 of tpl_n_checkout_.php from

        echo "\n" . $product['qty']

    to

        $products_ordered .= "\n" . $product['qty']

    and line 35 from

          $products_ordered_attributes .= "\n\t" . $attributes_values['option'] . ' ' . $attributes_values['value'];

    to

          $products_ordered .= "\n\t" . $attributes_values['option'] . ' ' . $attributes_values['value'];

    Although overall I think that copying n_checkout.php to n_checkout_mm.php, renaming the class and constants accordingly, and moving order-confirm into the module and template files would be better. 

    The two times where the code says $order->customer['firstname'] . ' ' . $order->customer['lastname'] would be better as just $order->customer['name']. 

×