Friday, February 10, 2017

opencart

/opencart/   2.2.0.0
/opencart2/ 2.3.1.0 github

localhost:10/opencart/

normal user:   huguowen@gmail.com   aaaa1111
admin:    hoogw    A1a18113


******************************

admin

hoogw
A1a18113


mysql connection:

host:    127.0.0.1
user name: hoogw
A1a18113

*************************************************










------------------------------------------------------

opencart.com  official web site, for extension download

aaaa1111


============================================
SEO search engine enable:

1) apache httpd.conf file, edit -  load mod_rewrite
   
      also,  change any "AllowOverride None" to "AllowOverride All"


2)
htdocs\opencart\.htaccess.txt   rename to \opencart\.htaccess

edit htaccess file.

change "RewriteBase /"  to "RewriteBase /opencart/"  [whatever your project base directory]
======================================================================

auto enable reviews.
add status = '1'


edit: catalog/model/catalog/review.php

find

 public function addReview($product_id, $data) {
      $this->db->query("INSERT INTO " . DB_PREFIX . "review SET author = '" . $this->db->escape($data['name']) . "', customer_id = '" . (int)$this->customer->getId() . "', product_id = '" . (int)$product_id . "', text = '" . $this->db->escape(strip_tags($data['text'])) . "', rating = '" . (int)$data['rating'] . "', date_added = NOW()");
   }

change to

public function addReview($product_id, $data) {
      $this->db->query("INSERT INTO " . DB_PREFIX . "review SET author = '" . $this->db->escape($data['name']) . "', customer_id = '" . (int)$this->customer->getId() . "', product_id = '" . (int)$product_id . "', text = '" . $this->db->escape(strip_tags($data['text'])) . "', rating = '" . (int)$data['rating'] . "', status = '1', date_added = NOW()");
   }


auto enable reviews.

================================================================





+++++++++++++++++++++++++
reset password not working: 


https://forum.opencart.com/viewtopic.php?f=181&t=160272

catalog/controller/account/reset.php
catalog/model/account/customer.php

in customer.php there is called the function 
getCustomerByCode($code)
and then obviously
editPassword($email, $password)

getCustomerByCode($code) says:
"SELECT customer_id, firstname, lastname FROM `" . DB_PREFIX . "customer` WHERE code = '" . $this->db->escape($code) . "' AND code != ''"

That is fine but editPassword($email, $password) needs the email in order to update the password to the new value!

I'll go ahead and alter the script into
"SELECT customer_id, firstname, lastname, email FROM `" . DB_PREFIX . "customer` WHERE code = '" . $this->db->escape($code) . "' AND code != ''"



It works as soon as I also modified catalog/controller/account/reset.php where it says
$this->model_account_customer->editPassword($customer_info['customer_id'], $this->request->post['password']);

That cant work since editPassword needs the customer email. 
Modify into:
$this->model_account_customer->editPassword($customer_info['email'], $this->request->post['password']);

Together with the adaption in catalog/model/account/customer.php it works as intended.
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++





















**************************************************************

Move opencart from localhost to server:

1) under root folder, modify config.php,   under admin folder, modify config.php
     change 'localhost' to ' 192.169.199.29'

/// HTTP
//define('HTTP_SERVER', 'http://localhost:10/opencart/');
 define('HTTP_SERVER', 'http://192.169.199.29:10/opencart/');

// HTTPS
//define('HTTPS_SERVER', 'http://localhost:10/opencart/');
define('HTTPS_SERVER', 'http://192.169.199.29:10/opencart/');

2) other backup database, 


Hello! This tutorial will guide you on how to move OpenCart template from localhost to the live server.
  1. First of all, we need to export a database. Navigate to your local phpmyadmin tool. Click on Export button and then on Go.
    OpenCart 2.x. How to move website from localhost to live server_1
    OpenCart 2.x. How to move website from localhost to live server_2
  2. Now navigate to your site root folder and make a zip archive out of its content.
    OpenCart 2.x. How to move website from localhost to live server_3
  3. Let’s upload the archive to the root folder on the live server. Navigate to the cPanel, click on the Upload button, find the needed archive and wait until it is uploaded. Extract the files then.
    OpenCart 2.x. How to move website from localhost to live server_4
    OpenCart 2.x. How to move website from localhost to live server_5
  4. Now we can import our newly exported SQL file to a new database. Navigate to your phpmyadmin tool on the live server.
  5. Click on Import, choose the SQL file and click on Go.
  6. At this point we need to edit two files which are config.php in the root folder and config.php in the admin folder.
    1. In the upper section you need to replace the current path with your new site URL
    2. In the middle section you need to replace the path with the path on your server, you can see it above.
    3. In the bottom section you need to insert your new database details.
    OpenCart 2.x. How to move website from localhost to live server_6
  7. Save changes and navigate to the admin folder to edit config.php file.
  8. Make the same changes to it.
  9. Save changes and check your site now.

This is the end of the tutorial. Feel free to check the detailed video tutorial below:


********************************************************************

No comments: