Jump to content

bsmither

Member
  • Posts

    18,012
  • Joined

  • Last visited

  • Days Won

    605

Posts posted by bsmither

  1. Good. Somewhere between [0] and [1] that $page is getting damaged.

    In /classes/catalogue.class.php:

    Use this debug statement:
    $GLOBALS['debug']->debugMessage('At '.__METHOD__.', line ('.__LINE__.'), $page is '.$page.' and $per_page is '.$per_page);
    
    Near lines 1783-1785, find:
        public function searchCatalogue($search_data = null, $page = 1, $per_page = 10, $search_mode = 'elastic')
        {
            $per_page = (!is_numeric($per_page) || $per_page < 1) ? 10 : $per_page;
    
    Add the debug statement after the end of the THIRD line.
    
    Near lines 1820-1825, find:
            if (strtolower($page) != 'all') {
                $page = (is_numeric($page)) ? $page : 1;
                $limit = sprintf('LIMIT %d OFFSET %d', (int)$per_page, $per_page*($page-1));
            } else {
                $limit = 'LIMIT 100';
            }
    
    Add the debug statement after the end of the SIXTH line.
    
    

    In /classes/cubecart.class.php:

    Near line 890-893, make sure the statements are as follows:
                $GLOBALS['gui']->addBreadcrumb($GLOBALS['language']->common['search'], 'index.php?_a=search');
                $GLOBALS['gui']->addBreadcrumb($GLOBALS['language']->navigation['search_results'], currentPage());
            } else {
                $GLOBALS['catalogue']->searchCatalogue($_GET['cat_id'], $page, $catalogue_products_per_page);

     

  2. In admin, at the bottom of the left-side navigation panel, click PHP Info. Near the bottom of the page is a table named PHP Variables.

    In that table, find $_SERVER['DOCUMENT_ROOT']. Note the path in the Value column.

    Make sure this is where you are looking for the /setup/ folder.

    When the setup folder is detected, a message is stored in your "session", but when giving the message to the skin template system (Smarty), the message is removed from your "session".

    There is nothing new about how this messaging works. So, for the message to not go away, or even be displayed, if there is, in fact, a /setup/ folder not to be found, is strange.

  3. I do not think so. (But we can explore this later.)

    In /classes/cubecart.class.php:

    Find near line 880-882:
    $page = (isset($_REQUEST['page']) && !empty($_REQUEST['page'])) ? $_REQUEST['page'] : 1;
    
    $catalogue_products_per_page = $GLOBALS['gui']->itemsPerPage();
    
    After these lines, add:
    $GLOBALS['debug']->debugMessage('At '.__METHOD__.', line ('.__LINE__.'), $page is '.$page.' and $catalogue_products_per_page is '.$catalogue_products_per_page);

    This is looking at code that executes just one step ahead of the searchCatalogue() function. If the $page number does change to 2, then we've narrowed where the problem exists.

    I see above that you mentioned you changed the skin config.xml file to default the number per page to 48.

     

  4. $GLOBALS['debug']->debugMessage('At '.__METHOD__.', line ('.__LINE__.'), $page is '.$page.' and $per_page is '.$per_page);
    
    In catalogue.class.php, near line 2110-2111, find:
                if (is_numeric($search_data)) {
                    if (($category = $this->getCategoryData((int)$search_data)) !== false) {
    
    Add the debug statement immediately after the end of the SECOND statement above.
    
    In catalogue.class.php, near lines 798-800, find:
                foreach ($GLOBALS['hooks']->load('class.catalogue.category_product_list') as $hook) {
                    include $hook;
                }
    
    Add the debug statement immediately after the end of the THIRD statement above.
    
    In catalogue.class.php, near lines 1106-1110, find:
            } else {
                $result = $GLOBALS['db']->select('CubeCart_inventory', false, $where, $order, $per_page, $page);
            }
    
            // Get product option specific data
    
    Add the debug statement immediately after the end of the FIRST statement above.

    At the bottom of the debug section (popup?) will be a set of Debug Messages.

  5. Being on page 2, it is the OFFSET 0 that I do not like.

    In /classes/catalogue.class.php, near lines 1820-1825, verify that these lines exist as follows:

            if (strtolower($page) != 'all') {
                $page = (is_numeric($page)) ? $page : 1;
                $limit = sprintf('LIMIT %d OFFSET %d', (int)$per_page, $per_page*($page-1));
            } else {
                $limit = 'LIMIT 100';
            }

    When page=all, I expect the LIMIT to be 100 and no OFFSET.

    --- Scratch all the above. ---

    Looking elsewhere.

  6. Your question implies you are viewing a page of items in a category. Fetching a list of products in a category list uses the function, searchCatalogue(), but does not interfere with the $page number that a regular search does. (See issue #3066 in the Github.)

    Please enable CubeCart's debug mode. (The Foundation skin as of CC650+ now shows the debug panel as a popup. (And, if using Firefox, you need to close the popup in order to see the popup of the next page. Otherwise, the next page of debug data has been added to the bottom of the existing content, but the popup might not scroll to that new data.)

    Make sure that, GET: "After Sanitation", there are 'cat_id' and a 'page' keys. Further down, look for a SQL statement that looks like:

    Probably close to query #22:
    SELECT * FROM `CubeCart_inventory` WHERE (`product_id` IN (2,19,20,21)) AND CubeCart_inventory.status = '1' ORDER BY `updated` ASC LIMIT 12 OFFSET 12;
    
    -- where OFFSET 12 is a multiple of 12,
    -- and (2,19,20,21) is a coma separated 
       list of products belonging to this category.

    As for the list of product_ids, how many values are in your list?

  7. CubeCart can try to use an un-salted password (like CubeCart v3), which will auto-update to a CC6 style password.

    But, in addition to encoding the password via md5, the database row must also have a blank salt value, and a zero for 'new_password'.

    You say things were fine until today.

    Please check if your hosting provider has upgraded your hosted environment (PHP version, etc).

  8. What we can try to do is a code snippet with a 'cron' trigger. So, at your other site, a simple form with method "get" (passes a querystring) will be processed by the snippet - which can be as lax as you need it to be.

    In admin, Manage Hooks, Code Snippets tab, click Add Snippet. Fill in the form that appears:

    Enabled: checked
    Unique ID: IngestSubscriberEmail@cc649+
    Execution Order: 1
    Description: Accepts and databases a subscriber's email address from outside CubeCart.
    Trigger: cron
    Version: 1.0.0
    Author: https://forums.cubecart.com/topic/58293-access-mailing-list-from-offsite
    Code:
    <?php
      /**
       * Uses the 'cron' hook
       * Does not restrict based on 'double opt-in' settings.
       * Does not restrict based on 'reCaptcha' settings.
       */
        if (isset($_GET['email'] && filter_var($_GET['email'], FILTER_VALIDATE_EMAIL)) {
            $email = strtolower($_GET['email']);
            $GLOBALS['db']->delete('CubeCart_newsletter_subscriber', array('email' => $email));
    
            $record = array(
                'status'  => true,
                'email'   => $email,
                'customer_id'   => 0,
                'ip_address' => get_ip_address(),
                'date' => date('c'),
                'imported' => true
            );
            $GLOBALS['db']->insert('CubeCart_newsletter_subscriber', $record);
        }

    The form to submit the data items:

    Form attributes:
    action="www.mystore.com"
    method="get"
    
    Form payload:
    _g=cron
    _m=runSnippets
    [email protected]

    Test thoroughly!

     

  9. In CubeCart's primary documents (index.php and admin_HaShEd.php), a header named 'X-Frame-Options' is set to "SAMEORIGIN". (Your web server may also be configured to always add this header to responses.)

    As such, if the visitor's browser (if it supports this directive) cannot be convinced to invisibly override this directive in order to show sources from other origins, what the browser will actually do about it is something I am not at all able to give any advice.

    You can try removing that statement in index.php.

     

     

  10. There is no direct setting that will show prices, but prevent ghost customers from making purchases.

    However, by using Catalogue Mode plus a Code Snippet, a solution can be found.

    Catalogue Mode (admin, Store Settings, Features tab, Misc section, "Disable Checkout") removes the ability for anyone to actually make a purchase.

    The Code Snippet will switch off Catalogue Mode when a customer logs in for that logged-in customer.

    In admin, Manage Hooks, Code Snippet tab, click Add Snippet.
    A form will be presented:
    Enabled: checked
    Unique ID: NotCatMode4LoggedIn@cc640+
    Execution Order: 99
    Description: Switches off Catalogue Mode for that logged-in user.
    Trigger: class.user.load.user
    Version: 1.0
    Author: https://forums.cubecart.com/topic/57901-registration-to-be-approved/
    Code:
    <?php
    /* Uses the hook 'class.user.load.user' located in code that
     * runs when a user gets logged in.
     * In admin, enable Catalogue Mode.
     * These statements will disable catalogue mode and have
     * the templates resume normal behavior for this user.
     */
     
     $GLOBALS['config']->merge('config', 'catalogue_mode', false);
     $GLOBALS['smarty']->assign('CATALOGUE_MODE', false);

     

  11. Unfortunately, CubeCart employs a one-off (nonce) "Security Token" that is unique for each POST payload to the storefront (which is coupled to a cookie-based 'session'). The programming code that processes the command to add an email address to CubeCart's Newsletter Subscriber database is looking only for POSTed key/values in the payload - not anything in the querystring.

    Without a current security token, all GET and POST key/values are unset.

    What needs to happen is to fetch any page from CubeCart. That page will have a form element of type=hidden containing the security token. Then, the form on the external site will submit a form:

    Form:
    action="www.mystore.com/?_a=newsletter"
    method="post"
    
    Payload:
    [email protected]
    token=hashcode_from_prior_page_load

    Cubecart also employs an optional "double-opt-in" where an email is sent to the address submitted with a link to CubeCart to verify the subscription.

    And CubeCart also employs an optional reCaptcha that must be solved prior to proceeding with certain functions - 'subscribing' is one of them.

    Currently, there is no known after-market extension that would provide for CubeCart accepting subscription requests outside of itself.

  12. Comparing the script shown above with the script used by GA, it seems the two are very similar.

    As such, adopting the GA plugin to create a new Microsoft Analytics (MSA) plugin should be straightforward. (Renaming a few things, and swapping out the javascript, essentially.)

    If you need help with the code changes, we can work through it.

  13. In admin, Mailing List, Export Subscribers tab, an admin can download a text file (plain text or CSV) containing newsletter subscribers. This list can be integrated into another list for use by an external program.

    On the Import Subscribers tab, a textbox exists to submit a list of email addresses to be added to CubeCart's newsletter subscriber list, if wanting to use CubeCart's feature of emailing a newsletter.

     

  14. There are separate variables for "description" and "description_short".

    If nothing is entered in the Add/Edit Product's "Short Description" editor box, then for the "description_short" variable, CubeCart will use the beginning of the "description" variable, having removed everything that is not simply text, up to the number of characters set in Product Precis. Otherwise, having Short Description content will be used for "description_short".

     

×
×
  • Create New...