Results 1 to 5 of 5
  1. #1
    Join Date
    Jan 2019
    Location
    UK
    Posts
    51
    Plugin Contributions
    0

    Default Problems copying some core edits to new store

    Hiya, I'm trying to copy some core edits (GDPR stuff) from my live site (1.5.6c) to a development store (1.5.7c) but im struggling to convert some array variables into a format that is acceptable to 1.5.7c with my limited knowledge of php.

    The last 2 gdpr variables of this array need to be moved over to my new site, and i've done it like this which is obviously missing some important formatting as I cannot create a new account on the devstore and it throws up an error.

    PHP Code:
    $sql_data_array = array('customers_firstname' => $firstname,
                                
    'customers_lastname' => $lastname,
                                
    'customers_email_address' => $email_address,
                                
    'customers_nick' => $nick,
                                
    'customers_telephone' => $telephone,
                                
    'customers_fax' => $fax,
                                
    'customers_newsletter' => (int)$newsletter,
                                
    'customers_email_format' => $email_format,
                                
    'customers_default_address_id' => 0,
                                
    'customers_password' => zen_encrypt_password($password),
                                
    'customers_authorization' => (int)CUSTOMERS_APPROVAL_AUTHORIZATION,
                                
    'gdpr_accept' => $gdpr_accept,
                                
    'gdpr_accept_date' => date('Y-m-d H:i:s')
        ); 
    The way I added them to the array in 1.5.7c was like this, but I think I need the ('Y-m-d H:i:s') added but am unsure or the exact formatting of the line

    PHP Code:
    $sql_data_array = array(array('fieldName'=>'customers_firstname''value'=>$firstname'type'=>'stringIgnoreNull'),
                               array(
    'fieldName'=>'customers_lastname''value'=>$lastname'type'=>'stringIgnoreNull'),
                               array(
    'fieldName'=>'customers_email_address''value'=>$email_address'type'=>'stringIgnoreNull'),
                               array(
    'fieldName'=>'customers_nick''value'=>$nick'type'=>'stringIgnoreNull'),
                               array(
    'fieldName'=>'customers_telephone''value'=>$telephone'type'=>'stringIgnoreNull'),
                               array(
    'fieldName'=>'customers_fax''value'=>$fax'type'=>'stringIgnoreNull'),
                               array(
    'fieldName'=>'customers_newsletter''value'=>$newsletter'type'=>'integer'),
                               array(
    'fieldName'=>'customers_email_format''value'=>$email_format'type'=>'stringIgnoreNull'),
                               array(
    'fieldName'=>'customers_default_address_id''value'=>0'type'=>'integer'),
                               array(
    'fieldName'=>'customers_password''value'=>zen_encrypt_password($password), 'type'=>'stringIgnoreNull'),
                               array(
    'fieldName'=>'customers_authorization''value'=>$customers_authorization'type'=>'integer'),
                               array(
    'fieldName'=>'gdpr_accept''value'=>$gdpr_accept'type'=>'integer'),
                               array(
    'fieldName'=>'gdpr_accept_date''value'=>$gdpr_accept_date'type'=>'date'),
        ); 
    I also tried changing the last line to include the date formatting but I think I did it wrong as my login page would not even load.

    PHP Code:
    array('fieldName'=>'gdpr_accept_date''value'=>$gdpr_accept_date'type'=>'date('Y-m-d H:i:s')'), 
    --> PHP Fatal error: 1292:Incorrect datetime value: '' for column `thegluep_tg1`.`zen_customers`.`gdpr_accept_date` at row 1 :: INSERT INTO zen_customers (customers_firstname, customers_lastname, customers_email_address, customers_nick, customers_telephone, customers_fax, customers_newsletter, customers_email_format, customers_default_address_id, customers_password, customers_authorization, gdpr_accept, gdpr_accept_date, customers_gender) VALUES ('Susan', 'Flaps', '[email protected]', '', '01202 820177', '', 0, 'TEXT', 0, '$2y$10$XiR0jqZoGg1cQ.kiON8iY.ORYkpKzCq91zc0RnEp3wwDIvBj1E26G', 0, 0, '', 'f') ==> (as called by) /home/thegluep/devstore.thegluepeople.co.uk/includes/modules/bootstrap/create_account.php on line 296 <== in /home/thegluep/devstore.thegluepeople.co.uk/includes/classes/db/mysql/query_factory.php on line 170.

  2. #2
    Join Date
    Jul 2012
    Posts
    15,820
    Plugin Contributions
    17

    Default Re: Problems copying some core edits to new store

    The problem with the original attempt is that the date being stored is "nothing", a pair of empty quotes. There is nothing wrong with the "format", just the value being stored. Now, the real question is what data is permitted in the field? For example, historically ZC has stored a date of '0001-01-01' if the entry is "nothing". That said, there are ongoing discussions about what the best value to store is because of the way mysql servers are starting to evaluate that information more.

    One acceptable value is NULL, if the field for the table doesn't prevent it. Otherwise, may suggest using the ZC default...

    Would suggest though trying to track/identify what that date is, or should be so that the query works and/or the database doesn't complain. May need to provide a specific date if the value provided is empty or similar.
    ZC Installation/Maintenance Support <- Site
    Contribution for contributions welcome...

  3. #3
    Join Date
    Jan 2019
    Location
    UK
    Posts
    51
    Plugin Contributions
    0

    Default Re: Problems copying some core edits to new store

    Ah that makes sense. When I copied the database to the devstore I did have an issue and followed the advice here to change the datebase default.

    https://www.zen-cart.com/showthread....75#post1378875

    so I guess I need to update my code to reflect that.

  4. #4
    Join Date
    Jan 2019
    Location
    UK
    Posts
    51
    Plugin Contributions
    0

    Default Re: Problems copying some core edits to new store

    Still struggling but learning so much as I continue to read up on things. Trying to narrow down what data is permitted in the field, i'm assuming that it wants to record the moment the customer creates the account with the GDPR compliance box ticked. I ran a full search for the gdpr_accept tag and this is what is returned.

    Name:  gdpr1.jpg
Views: 39
Size:  47.1 KB

    Line 97 of gdpr.php seems to have the wrong format date so changed it to 0001-01-01 00:00:00 but I still got the same date error when trying to create a new test account.

    Edit: better quality version of attached image - https://i.imgur.com/lAIQTqb.png

  5. #5
    Join Date
    Jan 2019
    Location
    UK
    Posts
    51
    Plugin Contributions
    0

    Default Re: Problems copying some core edits to new store

    All sorted now, Rick at JSWeb was kind enough to send me the 1.5.7b gdpr files, making it much easier to merge my installation.

 

 

Similar Threads

  1. Need some big picture advice for new store
    By rughooker in forum Setting Up Categories, Products, Attributes
    Replies: 2
    Last Post: 29 May 2009, 12:39 PM
  2. copying products over to a new site problems
    By jonnyboy22 in forum General Questions
    Replies: 6
    Last Post: 1 Feb 2009, 06:53 PM
  3. Large file in my store directory - core!
    By tbrides in forum General Questions
    Replies: 1
    Last Post: 22 Dec 2006, 03:27 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
disjunctive-egg
Zen-Cart, Internet Selling Services, Klamath Falls, OR