How to Install & Update Square for OpenCart 2.x

Before you begin We recommend you do a full backup of your OpenCart files and database, just in case.

Install using the OpenCart Extension Installer

  1. Unzip the downloaded Square .ZIP file into a new directory
  2. Go to Extensions > Extension Installer in your OpenCart admin
  3. Click Upload.
  4. Upload the file squareup.ocmod.zip located in the directory you created in Step 1.

    If you receive an error "Could not connect as..." this means you have not configured FTP credentials for your OpenCart Extension Installer. You can resolve this in two ways:
    Approach 1: Configure FTP from System > Settings > FTP
    Approach 2: Install the iSenseLabs QuickFix When you are done, try uploading squareup.ocmod.zip once again.

  5. Go to Extensions > Payments > Square and click the Install button.
  6. Go to Extensions > Modifications and refresh the modifications. If you are updating - this step is needed even for the OC 2.3.x version of the module.
  7. Go to Extensions > Payments > Square, find Square and click the Edit button.
  8. The control panel is displayed. Now, this is the place where you configure your Square module. Try clicking around the menu items to get acquainted with the module.

Congratulations! You just installed Square in OpenCart 2.x.

Manual Installation

  1. Unzip the downloaded Square .ZIP file into a new directory
  2. Navigate to this directory and find the file squareup.ocmod.zip
  3. Extract squareup.ocmod.zip into a new directory
  4. Navigate to the newly extracted directory. You will notice it contains a directory called upload/
  5. (Optional) If necessary, rename the admin/ and admin/language/english directories to match your OpenCart setup
  6. Upload the contents of the upload/ directory to your OpenCart installation, making sure to preserve the directory structure.
  7. (OpenCart 2.0.0.0 - OpenCart 2.2.0.0) Enter the directory you created and locate the squareup.ocmod.xml file in the _ocmod folder.
  8. (OpenCart 2.0.0.0 - OpenCart 2.2.0.0) Login to your OpenCart admin panel. Once you do that, go to Extensions -> Extension Installer.
  9. (OpenCart 2.0.0.0 - OpenCart 2.2.0.0) Upload the file squareup.ocmod.xml and wait for the success message.
  10. Go to Extensions > Modifications and refresh the modifications. If you are updating - this step is needed even for the OC 2.3.x version of the module.
  11. Go to Extensions > Payments > Square, find Square and click Install.
  12. Go to Extensions > Payments > Square, find Square and click Edit.
  13. The control panel is displayed. Now, this is the place where you configure your Square module. Try clicking around the menu items to get acquainted with the module.

Congratulations! You just installed Square in OpenCart 2.x.

Configuration

To learn how to configure Square, please follow our video tutorial or head over to the Integration Settings page.

Update Instructions

Before you begin We recommend you do a full backup of your OpenCart files and database, just in case.

  1. Follow one of the above installation methods
  2. Go to Extensions > Payments > Square > Edit and configure your settings
  3. Click Save on the top right
  4. (Important) Please make sure that your CRON is set to run every minute instead of every hour. Also, please ensure the Square command is up-to-date in your CRON jobs. You can find more information on how to set the CRON on the CRON Job Settings page.

That's it! Square is now updated.

Developers

The modification will be applied for the following OpenCart files:

OpenCart 2.0.0.0 - OpenCart 2.1.0.2

  • admin/controller/common/dashboard.php: Injects a link into the dashboard to show a token expiration message.
  • admin/view/template/common/dashboard.tpl: Injects an Ajax call into the dashboard to check whether Square's access token is about to expire.
  • admin/controller/catalog/product.php: Loads the code for the warning message about the product quantity editing addition to the product view.
  • admin/view/template/catalog/product_form.tpl: Injects a warning message about the product quantity editing to the product view.
  • admin/controller/common/menu.php: Loads the code for displaying the quick link to the admin menu.
  • admin/view/template/common/menu.tpl: Injects a quick access link into the admin menu.
  • admin/controller/sale/order.php: Injects a link to the order info in the order page.
  • admin/view/template/sale/order_info.tpl: Inserts a link to the Square transaction view.
  • catalog/view/theme/*/template/account/account.tpl: Inserts the "Manage Stored Credit Cards" link in the user's main account page.
  • catalog/controller/{module/module}/account.php: Loads Square's language file for displaying the extension's account page additions.

OpenCart 2.2.0.0

  • admin/controller/common/menu.php: Loads the code for displaying the quick link to the admin menu.
  • admin/view/template/common/menu.tpl: Injects a quick access link into the admin menu.
  • catalog/controller/account/account.php: Loads the code for the stored credit cards.

The following events will be applied:

OpenCart 2.2.0.0

  • admin/controller/*/after => payment/squareup/setAdminURL - This is an event handler triggered once per admin panel request because admin directory name may get modified while a CRON job is registered. This method sets payment_squareup_admin_url_transaction and payment_squareup_admin_url_settings required by the Square catalog method ControllerExtensionPaymentSquareup::info().
  • admin/view/common/dashboard/before => payment/squareup/setAccessTokenAlert - Injects an Ajax call into the dashboard to check whether Square's access token is about to expire.
  • admin/view/catalog/product_form/before => payment/squareup/setProductWarning - This loads the warning message about the product quantity editing addition to the product view.
  • catalog/model/checkout/order/addOrderHistory/before => payment/squareup/beforeAddOrderHistory - This adds the order data to the Square extension.
  • catalog/model/checkout/order/addOrderHistory/after => payment/squareup/afterAddOrderHistory - This process the data after the order history is updated via Square or OpenCart.

OpenCart 2.3.0.x All of the above plus:

  • admin/view/common/column_left/before => extension/payment/squareup/setAdminLink - this adds quick link to the admin menu

After installation/update the following new database tables will be introduced:

  • squareup_ad_hoc: This is used to store the ad-hoc order items in OpenCart. It is used to restrict re-stocks for ad-hoc items.
  • squareup_catalog: This holds the data for the Square catalog - Square ID, product and product options data, Square location, etc.
  • squareup_category_category: This holds the Square references between OpenCart categories and Square categories.
  • squareup_combination: This hold the combinations between the required product options - OpenCart product ID, option name, etc.
  • squareup_combination_item_variation: This hold the references between OpenCart combinations and Square item variations.
  • squareup_customer: This holds the relationships between your registered customers and your Square customers.
  • squareup_diff: This holds the information about the difference between Square's and OpenCart's data and the history about the changes made to them.
  • squareup_option_modifier_list: This is currently a deprecated table which might be used in a future version.
  • squareup_option_value_modifier: This is currently a deprecated table which might be used in a future version.
  • squareup_product_item: This holds the references between OpenCart products and Square items.
  • squareup_product_item_image: This holds references between product images and Square images.
  • squareup_product_option_modifier_list: This is currently a deprecated table which might be used in a future version.
  • squareup_product_option_value_modifier: This is currently a deprecated table which might be used in a future version.
  • squareup_refund: This one holds the data for the refunds - ordered product ID, quantity of the refund.
  • squareup_restock: This holds the data for the restocked items.
  • squareup_tax_rate_tax: This is currently a deprecated table which might be used in a future version.
  • squareup_token: This holds the relationships between your registered customers and their credit card tokens.
  • squareup_transaction: This holds all transactions created by the extension.