Удалил googleshopping
This commit is contained in:
File diff suppressed because it is too large
Load Diff
@@ -1,85 +0,0 @@
|
||||
<?php
|
||||
class ControllerExtensionAnalyticsGoogle extends Controller {
|
||||
private $error = array();
|
||||
|
||||
public function index() {
|
||||
$this->load->language('extension/analytics/google');
|
||||
|
||||
$this->document->setTitle($this->language->get('heading_title'));
|
||||
|
||||
$this->load->model('setting/setting');
|
||||
|
||||
if (($this->request->server['REQUEST_METHOD'] == 'POST') && $this->validate()) {
|
||||
$this->model_setting_setting->editSetting('analytics_google', $this->request->post, $this->request->get['store_id']);
|
||||
|
||||
$this->session->data['success'] = $this->language->get('text_success');
|
||||
|
||||
$this->response->redirect($this->url->link('marketplace/extension', 'user_token=' . $this->session->data['user_token'] . '&type=analytics', true));
|
||||
}
|
||||
|
||||
if (isset($this->error['warning'])) {
|
||||
$data['error_warning'] = $this->error['warning'];
|
||||
} else {
|
||||
$data['error_warning'] = '';
|
||||
}
|
||||
|
||||
if (isset($this->error['code'])) {
|
||||
$data['error_code'] = $this->error['code'];
|
||||
} else {
|
||||
$data['error_code'] = '';
|
||||
}
|
||||
|
||||
$data['breadcrumbs'] = array();
|
||||
|
||||
$data['breadcrumbs'][] = array(
|
||||
'text' => $this->language->get('text_home'),
|
||||
'href' => $this->url->link('common/dashboard', 'user_token=' . $this->session->data['user_token'], true)
|
||||
);
|
||||
|
||||
$data['breadcrumbs'][] = array(
|
||||
'text' => $this->language->get('text_extension'),
|
||||
'href' => $this->url->link('marketplace/extension', 'user_token=' . $this->session->data['user_token'] . '&type=analytics', true)
|
||||
);
|
||||
|
||||
$data['breadcrumbs'][] = array(
|
||||
'text' => $this->language->get('heading_title'),
|
||||
'href' => $this->url->link('extension/analytics/google', 'user_token=' . $this->session->data['user_token'] . '&store_id=' . $this->request->get['store_id'], true)
|
||||
);
|
||||
|
||||
$data['action'] = $this->url->link('extension/analytics/google', 'user_token=' . $this->session->data['user_token'] . '&store_id=' . $this->request->get['store_id'], true);
|
||||
|
||||
$data['cancel'] = $this->url->link('marketplace/extension', 'user_token=' . $this->session->data['user_token'] . '&type=analytics', true);
|
||||
|
||||
$data['user_token'] = $this->session->data['user_token'];
|
||||
|
||||
if (isset($this->request->post['analytics_google_code'])) {
|
||||
$data['analytics_google_code'] = $this->request->post['analytics_google_code'];
|
||||
} else {
|
||||
$data['analytics_google_code'] = $this->model_setting_setting->getSettingValue('analytics_google_code', $this->request->get['store_id']);
|
||||
}
|
||||
|
||||
if (isset($this->request->post['analytics_google_status'])) {
|
||||
$data['analytics_google_status'] = $this->request->post['analytics_google_status'];
|
||||
} else {
|
||||
$data['analytics_google_status'] = $this->model_setting_setting->getSettingValue('analytics_google_status', $this->request->get['store_id']);
|
||||
}
|
||||
|
||||
$data['header'] = $this->load->controller('common/header');
|
||||
$data['column_left'] = $this->load->controller('common/column_left');
|
||||
$data['footer'] = $this->load->controller('common/footer');
|
||||
|
||||
$this->response->setOutput($this->load->view('extension/analytics/google', $data));
|
||||
}
|
||||
|
||||
protected function validate() {
|
||||
if (!$this->user->hasPermission('modify', 'extension/analytics/google')) {
|
||||
$this->error['warning'] = $this->language->get('error_permission');
|
||||
}
|
||||
|
||||
if (!$this->request->post['analytics_google_code']) {
|
||||
$this->error['code'] = $this->language->get('error_code');
|
||||
}
|
||||
|
||||
return !$this->error;
|
||||
}
|
||||
}
|
||||
@@ -1,99 +0,0 @@
|
||||
<?php
|
||||
class ControllerExtensionCaptchaGoogle extends Controller {
|
||||
private $error = array();
|
||||
|
||||
public function index() {
|
||||
$this->load->language('extension/captcha/google');
|
||||
|
||||
$this->document->setTitle($this->language->get('heading_title'));
|
||||
|
||||
$this->load->model('setting/setting');
|
||||
|
||||
if (($this->request->server['REQUEST_METHOD'] == 'POST') && $this->validate()) {
|
||||
$this->model_setting_setting->editSetting('captcha_google', $this->request->post);
|
||||
|
||||
$this->session->data['success'] = $this->language->get('text_success');
|
||||
|
||||
$this->response->redirect($this->url->link('marketplace/extension', 'user_token=' . $this->session->data['user_token'] . '&type=captcha', true));
|
||||
}
|
||||
|
||||
if (isset($this->error['warning'])) {
|
||||
$data['error_warning'] = $this->error['warning'];
|
||||
} else {
|
||||
$data['error_warning'] = '';
|
||||
}
|
||||
|
||||
if (isset($this->error['key'])) {
|
||||
$data['error_key'] = $this->error['key'];
|
||||
} else {
|
||||
$data['error_key'] = '';
|
||||
}
|
||||
|
||||
if (isset($this->error['secret'])) {
|
||||
$data['error_secret'] = $this->error['secret'];
|
||||
} else {
|
||||
$data['error_secret'] = '';
|
||||
}
|
||||
|
||||
$data['breadcrumbs'] = array();
|
||||
|
||||
$data['breadcrumbs'][] = array(
|
||||
'text' => $this->language->get('text_home'),
|
||||
'href' => $this->url->link('common/dashboard', 'user_token=' . $this->session->data['user_token'], true)
|
||||
);
|
||||
|
||||
$data['breadcrumbs'][] = array(
|
||||
'text' => $this->language->get('text_extension'),
|
||||
'href' => $this->url->link('marketplace/extension', 'user_token=' . $this->session->data['user_token'] . '&type=captcha', true)
|
||||
);
|
||||
|
||||
$data['breadcrumbs'][] = array(
|
||||
'text' => $this->language->get('heading_title'),
|
||||
'href' => $this->url->link('extension/captcha/google', 'user_token=' . $this->session->data['user_token'], true)
|
||||
);
|
||||
|
||||
$data['action'] = $this->url->link('extension/captcha/google', 'user_token=' . $this->session->data['user_token'], true);
|
||||
|
||||
$data['cancel'] = $this->url->link('marketplace/extension', 'user_token=' . $this->session->data['user_token'] . '&type=captcha', true);
|
||||
|
||||
if (isset($this->request->post['captcha_google_key'])) {
|
||||
$data['captcha_google_key'] = $this->request->post['captcha_google_key'];
|
||||
} else {
|
||||
$data['captcha_google_key'] = $this->config->get('captcha_google_key');
|
||||
}
|
||||
|
||||
if (isset($this->request->post['captcha_google_secret'])) {
|
||||
$data['captcha_google_secret'] = $this->request->post['captcha_google_secret'];
|
||||
} else {
|
||||
$data['captcha_google_secret'] = $this->config->get('captcha_google_secret');
|
||||
}
|
||||
|
||||
if (isset($this->request->post['captcha_google_status'])) {
|
||||
$data['captcha_google_status'] = $this->request->post['captcha_google_status'];
|
||||
} else {
|
||||
$data['captcha_google_status'] = $this->config->get('captcha_google_status');
|
||||
}
|
||||
|
||||
$data['header'] = $this->load->controller('common/header');
|
||||
$data['column_left'] = $this->load->controller('common/column_left');
|
||||
$data['footer'] = $this->load->controller('common/footer');
|
||||
|
||||
$this->response->setOutput($this->load->view('extension/captcha/google', $data));
|
||||
}
|
||||
|
||||
protected function validate() {
|
||||
if (!$this->user->hasPermission('modify', 'extension/captcha/google')) {
|
||||
$this->error['warning'] = $this->language->get('error_permission');
|
||||
}
|
||||
|
||||
if (!$this->request->post['captcha_google_key']) {
|
||||
$this->error['key'] = $this->language->get('error_key');
|
||||
}
|
||||
|
||||
if (!$this->request->post['captcha_google_secret']) {
|
||||
$this->error['secret'] = $this->language->get('error_secret');
|
||||
}
|
||||
|
||||
return !$this->error;
|
||||
}
|
||||
}
|
||||
@@ -1,323 +0,0 @@
|
||||
<?php
|
||||
|
||||
// Heading
|
||||
$_['heading_campaign'] = 'Smart Shopping Ad Campaigns';
|
||||
$_['heading_mapping'] = 'Category Mapping';
|
||||
$_['heading_merchant'] = 'Google Merchant Center Account';
|
||||
$_['heading_shipping_taxes'] = 'Shipping & Taxes';
|
||||
$_['heading_title'] = 'Google Shopping';
|
||||
|
||||
// Steps
|
||||
$_['step_campaigns'] = 'Smart Shopping Ad Campaigns';
|
||||
$_['step_connect'] = 'Connect';
|
||||
$_['step_mapping'] = 'Category Mapping';
|
||||
$_['step_merchant_account'] = 'Merchant Center Account';
|
||||
$_['step_shipping_taxes'] = 'Shipping & Taxes';
|
||||
|
||||
// Help
|
||||
$_['help_adult'] = 'Use this attribute to indicate that individual products are for adults only because they contain adult content such as nudity, sexually suggestive content, or are intended to enhance sexual activity. Google cares what they show to their users, so if your business model is not adult oriented but you're selling an individual adult-oriented product, you need to label that product clearly so Google can show appropriate and legally compliant content to people shopping online.';
|
||||
$_['help_age_group'] = 'Use this attribute to set the demographic that your product is designed for. When you use this attribute, your ad can appear in results that are filtered by age. For example, if results are filtered by Women instead of Girls. The Age Group can also work together with the Gender to help ensure that users see the correct size information.';
|
||||
$_['help_budget'] = 'Average daily budget to spend on this campaign. Any spending on ads will be deducted from your purchased credit. Credit is deducted only when someone clicks on your ad.';
|
||||
$_['help_carrier_price_percentage'] = 'Estimate the shipment price as percentage of the product price.';
|
||||
$_['help_color'] = 'If the product a color option, select it here. This is a required attribute for all apparel items in feeds that target Brazil, France, Germany, Japan, the UK, and the US as well as all products available in different colors.';
|
||||
$_['help_condition'] = 'Tell users about the condition of the product you're selling. Setting this value correctly is important since Google uses it to refine search results.';
|
||||
$_['help_cron_email'] = 'A summary of the CRON task will be sent to this e-mail after completion.';
|
||||
$_['help_cron_email_status'] = 'Enable to receive a summary after every CRON task.';
|
||||
$_['help_feed'] = 'If a language or currency is inactive, this means it was not found on your OpenCart store. To set it up, go to System > Localisation > Languages / Currencies';
|
||||
$_['help_gender'] = 'Specify the gender your product is designed for using the gender attribute. When you provide this information, potential customers can accurately filter products by gender to help narrow their search. Keep in mind that Google also uses the gender information together with the values you provide for Size and Age Group to standardize the sizes that are shown to users.';
|
||||
$_['help_google_product_category'] = 'Use the this attribute to indicate the category of your item based on the Google product taxonomy. Categorizing your product helps ensure that your ad is shown with the right search results.';
|
||||
$_['help_is_bundle'] = 'Use the Bundle attribute to indicate that you've created a bundle: a main product that you've grouped with other, different products, sold together as one package for a single price. This attribute lets Google show your ad in the right situations by distinguishing your item from manufacturer-created bundles, multipacks, and other products without accessories.';
|
||||
$_['help_local_cron'] = '<strong>This method is recommended.</strong> Insert this command in your web server CRON tab. Set it up to run every hour.';
|
||||
$_['help_multipack'] = 'Use the Multipack attribute to indicate that you've grouped multiple identical products for sale as one item. This attribute lets Google show your ad in the right situations by distinguishing your item from manufacturer-created multipacks, bundles, and other products.';
|
||||
$_['help_remote_cron'] = '<strong>Use this method in case Method #1 cannot be used.</strong> Use this URL to set up a CRON task via a web-based CRON service. Set it up to run every hour.';
|
||||
$_['help_roas'] = 'Target ROAS lets you bid based on a target return on ad spend (ROAS). This Google Ads Smart Bidding strategy helps you get more conversion value or revenue at the target return-on-ad-spend (ROAS) you set. Your bids are automatically optimized at auction-time, allowing you to tailor bids for each auction.';
|
||||
$_['help_size'] = 'Use the size attribute to describe the standardized size of your product. When you use this attribute, your ad can appear in results that are filtered by size. The size you submit will also affect how your product variants are shown.';
|
||||
$_['help_size_system'] = 'With this attribute you can explain which country's sizing system your product uses. This information helps create accurate filters, which users can use to narrow search results. The sizing system that you submit will affect search, filtering, and how variants are shown in your ad.';
|
||||
$_['help_size_type'] = 'Use this attribute to describe the cut of your product. This information helps create accurate filters, which users can use to narrow search results.';
|
||||
|
||||
// Entry
|
||||
$_['entry_action'] = 'Action';
|
||||
$_['entry_adult'] = 'Adult-Only Content';
|
||||
$_['entry_age_group'] = 'Age Group';
|
||||
$_['entry_auto_advertise'] = 'Automatically advertise new listings?';
|
||||
$_['entry_budget'] = 'Daily Campaign Budget';
|
||||
$_['entry_campaign'] = 'Smart Shopping Ad Campaigns';
|
||||
$_['entry_campaign_name'] = 'Campaign Name';
|
||||
$_['entry_color'] = 'Color Option';
|
||||
$_['entry_condition'] = 'Condition';
|
||||
$_['entry_country'] = 'Target Country';
|
||||
$_['entry_feed'] = 'Product Feeds';
|
||||
$_['entry_gender'] = 'Gender';
|
||||
$_['entry_google_product_category'] = 'Google Product Category';
|
||||
$_['entry_is_bundle'] = 'Bundle';
|
||||
$_['entry_max_transit_time'] = 'Maximum Transit Time (days)';
|
||||
$_['entry_min_transit_time'] = 'Minimum Transit Time (days)';
|
||||
$_['entry_multipack'] = 'Multipack (number of items in a single package)';
|
||||
$_['entry_oc_category'] = 'OpenCart Category (autocomplete)';
|
||||
$_['entry_roas'] = 'ROAS';
|
||||
$_['entry_setup_confirmation'] = 'Setup Confirmation';
|
||||
$_['entry_size'] = 'Size Option';
|
||||
$_['entry_size_system'] = 'Size System';
|
||||
$_['entry_size_type'] = 'Size Type';
|
||||
$_['entry_status'] = 'Status';
|
||||
|
||||
// Texts
|
||||
$_['text_access_token'] = 'Access token';
|
||||
$_['text_acknowledge_add_campaign_1'] = 'I acknowledge that my campaigns will not become active until my product feeds get approved according to the <a href="https://support.google.com/merchants/answer/6149970" target="_blank"><strong>Google Merchant Center requirements</strong></a>.';
|
||||
$_['text_acknowledge_add_campaign_2'] = 'I acknowledge that my campaigns will not become active until I set up <a href="https://support.google.com/merchants/topic/7293661?hl=en-GB&ref_topic=7259125" target="_blank"><strong>Shipping</strong></a> and <a href="https://support.google.com/merchants/topic/7294266?hl=en-GB&ref_topic=7259125" target="_blank"><strong>Tax (only in the US)</strong></a> details for my Merchant Center account.';
|
||||
$_['text_acknowledge_cron'] = 'I confirm that I have set up an automated CRON task using one of the methods above.';
|
||||
$_['text_acknowledge_merchant_tos'] = 'By purchasing Google Shopping ads, I agree to comply with Google's terms and policies, including Google's <a href="https://support.google.com/merchants/answer/160173?hl=en" target="_blank">Merchant Center terms of service</a>, <a href="https://support.google.com/merchants/answer/6149970?hl=en" target="_blank">Shopping ads policies</a>, and <a href="https://billing.google.com/payments/u/0/paymentsinfofinder?style=:md#" target="_blank">Google Ads Terms and Conditions</a>.';
|
||||
$_['text_action'] = 'Action';
|
||||
$_['text_active'] = 'Active';
|
||||
$_['text_active_states'] = 'Select active states';
|
||||
$_['text_add_target'] = 'New Campaign';
|
||||
$_['text_ads_intro'] = '<h3>Important</h3><p>To have your products accepted by Google Merchant Center, please make sure to follow these requirements:</p><ul><li>Your OpenCart products must meet the <a href="https://support.google.com/merchants/answer/6149970" target="_blank"><strong>Google Shopping ads policies</strong></a>.</li><li>Please make sure to configure <a href="https://support.google.com/merchants/topic/7293661?hl=en-GB&ref_topic=7259125" target="_blank"><strong>Shipping</strong></a> and <a href="https://support.google.com/merchants/topic/7294266?hl=en-GB&ref_topic=7259125" target="_blank"><strong>Taxes (only in the US)</strong></a> in your Google Merchant Center account, or via this extension from the <a href="%s" target="_blank"><strong>Shipping & Taxes</strong></a> section.</li><li>Refer to the columns <strong>Destination Statuses</strong> and <strong>Item Issues</strong> to resolve any approval issues with your products.</li></ul>';
|
||||
$_['text_advertise'] = 'Advertise';
|
||||
$_['text_age_group_adult'] = 'Adult (teens or older)';
|
||||
$_['text_age_group_infant'] = 'Infant (3-12 months old)';
|
||||
$_['text_age_group_kids'] = 'Kids (6-13 years old)';
|
||||
$_['text_age_group_newborn'] = 'Newborn (0-2 months old)';
|
||||
$_['text_age_group_toddler'] = 'Toddler (1-5 years old)';
|
||||
$_['text_all'] = 'All';
|
||||
$_['text_app_id'] = 'App ID';
|
||||
$_['text_app_secret'] = 'App Secret';
|
||||
$_['text_approved'] = 'Approved';
|
||||
$_['text_campaign_more_info'] = '<h4>Campaign Duration</h4><p>Campaigns will run until paused. You can pause a campaign at any time.</p><hr /><h4>Campaign Optimization</h4><p>It usually takes around 30 days for Google to rank products and optimize shopping ad campaigns.</p><hr /><h4>Products in Campaign</h4><p>Google will create a unique shopping ad for each approved product synced to your Merchant Center account. Ads are optimized based to maximize your sales. Popular products will likely receive more of your budget.</p><hr /><h4>Campaign Duration</h4><p>Campaigns will run until paused. You can pause a campaign at any time.</p><hr /><h4>Shopping Ad Placement</h4><p>Your ads may appear on multiple platforms including Google Search, Google Display Network, Youtube, and Gmail.</p>';
|
||||
$_['text_campaigns'] = 'Campaigns';
|
||||
$_['text_carrier_postcode'] = 'Origin Postal Code';
|
||||
$_['text_carrier_price_percentage'] = 'Price Percentage';
|
||||
$_['text_checklist_acknowledge_0'] = '<h4>Видимость каталога товаров</h4><p>Я подтверждаю, что мой каталог товаров общедоступен без необходимости ввода пароля.</p>';
|
||||
$_['text_checklist_acknowledge_1'] = '<h4>Безопасный процесс оформления заказа</h4><p>Обработка платежей и транзакций, а также сбор любой конфиденциальной и финансовой информации от пользователя осуществляется через безопасный сервер обработки (защищенный SSL, с действующим сертификатом SSL - https: //).</p>';
|
||||
$_['text_checklist_acknowledge_2'] = '<h4>Политика возврата</h4><p>Я подтверждаю, что мой веб-сайт предоставляет пользователям четкую и понятную политику возврата.</p>';
|
||||
$_['text_checklist_acknowledge_3'] = '<h4>Условия выставления счетов и оплаты</h4><p>Я подтверждаю, что мой веб-сайт предоставляет четкие и понятные условия выставления счетов и оплаты.</p>';
|
||||
$_['text_checklist_acknowledge_4'] = '<h4>Достоверная контактная информация</h4><p>Я подтверждаю, что мой веб-сайт отображает достаточную и точную контактную информацию с <em>как минимум двумя</em> из следующего: номер телефона, физический адрес, адрес электронной почты.</p>';
|
||||
$_['text_checklist_intro'] = '<h3>Важно</h3> Прежде чем вы сможете размещать рекламу в Google, ваш интернет-магазин <em>должен</em> соответствовать требованиям Google Merchant Center. Полный список всех требований и рекомендаций можно найти <a href="https://support.google.com/merchants/answer/6363310?hl=ru" target="_blank"><strong>здесь</strong></a>.';
|
||||
$_['text_clicks'] = 'Clicks';
|
||||
$_['text_color'] = 'Color';
|
||||
$_['text_condition_new'] = 'New';
|
||||
$_['text_condition_refurbished'] = 'Refurbished';
|
||||
$_['text_condition_used'] = 'Used';
|
||||
$_['text_connect_intro'] = 'Your Google Shopping extension is not yet connected. Please go to the <a href="%s" target="_blank"><strong>Google Shopping for OpenCart website</strong></a> to obtain an App ID and App Secret.';
|
||||
$_['text_connected'] = 'Connected with Merchant ID <span class="label label-default">%s</span>';
|
||||
$_['text_connecting'] = 'Connecting...';
|
||||
$_['text_connection'] = 'Connection';
|
||||
$_['text_conversion_value'] = 'Conversion Value';
|
||||
$_['text_conversions'] = 'Conversions';
|
||||
$_['text_cost'] = 'Cost';
|
||||
$_['text_critical'] = 'Critical';
|
||||
$_['text_cron_email'] = 'Send Summary to E-Mail';
|
||||
$_['text_cron_email_status'] = 'Send E-Mail Summary';
|
||||
$_['text_cron_info'] = 'Please make sure to set up a CRON task executing <strong>each hour</strong> using one of the methods below. Method #1 is recommended. CRON jobs help you with:<br /><br />• Periodic syncing of your OpenCart catalog with Google Merchant Center<br />• Automatic fetching of product statuses and product reports';
|
||||
$_['text_cron_settings'] = 'CRON Settings';
|
||||
$_['text_data_quality_issues'] = 'Data Quality Issues';
|
||||
$_['text_debug_log'] = 'Debug Logging';
|
||||
$_['text_destination_status'] = 'Status';
|
||||
$_['text_disabled'] = 'Disabled';
|
||||
$_['text_disapproved'] = 'Disapproved';
|
||||
$_['text_disconnect_reminder'] = 'Even if you decide to disconnect this OpenCart extension, you will still have access to your Merchant Center account. It will not get deleted. Disconnecting will do the following:<ul><li>Disable this extension</li><li>Remove all active campaigns</li><li>Delete all datafeeds in the linked Google Merchant Center account</li><li>Remove any links between your existing Google Merchant Center account and OpenCart.</li></ul>';
|
||||
$_['text_disconnecting_please_wait'] = 'Disconnecting...';
|
||||
$_['text_does_not_apply'] = '-- Does not apply --';
|
||||
$_['text_download_debug_log'] = 'Download Debug Log';
|
||||
$_['text_edit_target'] = 'Edit Campaign: %s';
|
||||
$_['text_enabled'] = 'Enabled';
|
||||
$_['text_error'] = 'Error';
|
||||
$_['text_existing_merchant'] = 'Use my own Google Merchant Center account (In case you want to use your active Google Merchant Center account.)';
|
||||
$_['text_extension_settings'] = 'Extension Settings';
|
||||
$_['text_extensions'] = 'Расширения';
|
||||
$_['text_filter'] = 'Filter';
|
||||
$_['text_gender_female'] = 'Female';
|
||||
$_['text_gender_male'] = 'Male';
|
||||
$_['text_gender_unisex'] = 'Unisex';
|
||||
$_['text_google_expiration_date'] = 'Google Expiration Date';
|
||||
$_['text_heading_merchant_center_account'] = 'Merchant Center Account';
|
||||
$_['text_home'] = 'Главная';
|
||||
$_['text_image'] = 'Image';
|
||||
$_['text_impressions'] = 'Impressions';
|
||||
$_['text_info_popup_product'] = 'The information requested here is required to properly list your product on Google Shopping. <a href="https://support.google.com/merchants/answer/7052112?hl=en&ref_topic=6324338" target="_blank">Click here</a> for more information.';
|
||||
$_['text_issues'] = 'Issues';
|
||||
$_['text_item_level_issues'] = 'Item Issues';
|
||||
$_['text_label_active'] = 'ACTIVE';
|
||||
$_['text_label_approved'] = 'APPROVED';
|
||||
$_['text_label_critical'] = 'CRITICAL';
|
||||
$_['text_label_disapproved'] = 'DISAPPROVED';
|
||||
$_['text_label_error'] = 'ERROR';
|
||||
$_['text_label_paused'] = 'PAUSED';
|
||||
$_['text_label_pending'] = 'PENDING';
|
||||
$_['text_label_suggestion'] = 'SUGGESTION';
|
||||
$_['text_label_unassigned'] = 'UNASSIGNED';
|
||||
$_['text_label_unavailable'] = 'UNAVAILABLE';
|
||||
$_['text_learn_more'] = 'Learn more';
|
||||
$_['text_loading_please_wait'] = 'Please wait. This may take a few minutes...';
|
||||
$_['text_local_cron'] = 'Method #1 - CRON Task:';
|
||||
$_['text_mapping_intro'] = 'Select your OpenCart categories which best match the pre-defined Google categories. This helps Google understand what you\'re selling so that they can better connect your ads with search queries from potential customers. If none of your categories match the list below, just click "Proceed" to skip this step.';
|
||||
$_['text_mapping_verify_intro'] = 'Some of your products are already mapped to Google categories. Should the new mapping edit all current products, or should it apply only for your future products?';
|
||||
$_['text_mapping_verify_title'] = 'Confirm New Mapping';
|
||||
$_['text_maximum_five'] = 'Maximum 5 campaigns can be selected. Leaving a campaign unticked will <strong>unassign</strong> the products from this campaign.';
|
||||
$_['text_merchant_intro'] = 'Please select the account you wish to use:';
|
||||
$_['text_merchant_website_claim'] = '<p>Upon clicking <strong>Proceed</strong>, you will be asked to authorize OpenCart to manage your listing and account in Google Shopping. Your website URL will be claimed by the selected Merchant Center account.</p>';
|
||||
$_['text_na'] = '–';
|
||||
$_['text_new_merchant'] = 'Use an account managed by OpenCart (For beginners who do not have a Google Merchant Center account.)';
|
||||
$_['text_no'] = 'No';
|
||||
$_['text_no_results'] = 'No results found!';
|
||||
$_['text_no_targets'] = 'No campaigns found! Click the button below to add your first campaign.';
|
||||
$_['text_panel_connect'] = 'Step 1 of 5: Connect the Google Shopping Extension';
|
||||
$_['text_panel_heading'] = 'Редактировать Google Shopping | Магазин: %s';
|
||||
$_['text_panel_heading_campaign'] = 'Step 3 of 5: Set up Smart Shopping Ad Campaigns';
|
||||
$_['text_panel_heading_campaign_2'] = 'Set up Smart Shopping Ad Campaigns';
|
||||
$_['text_panel_heading_mapping'] = 'Step 5 of 5: Set up Category Mapping';
|
||||
$_['text_panel_heading_mapping_2'] = 'Set up Category Mapping';
|
||||
$_['text_panel_heading_merchant'] = 'Step 2 of 5: Set up Google Merchant Center Account';
|
||||
$_['text_panel_heading_more_info'] = 'About Campaigns';
|
||||
$_['text_panel_heading_preview'] = 'How an Ad Looks Like';
|
||||
$_['text_panel_heading_shipping_taxes'] = 'Step 4 of 5: Set up Shipping & Taxes';
|
||||
$_['text_panel_heading_shipping_taxes_2'] = 'Set up Shipping & Taxes';
|
||||
$_['text_paused'] = 'Paused';
|
||||
$_['text_per_day'] = '$%s / day';
|
||||
$_['text_popup_error_body'] = 'The following error has occurred while trying to fetch this resource: <strong>{error}</strong>';
|
||||
$_['text_popup_error_title'] = 'Error';
|
||||
$_['text_popup_loading_body'] = 'Loading... Please wait...';
|
||||
$_['text_popup_loading_title'] = 'Loading form...';
|
||||
$_['text_popup_title_multiple'] = 'Editing %s products';
|
||||
$_['text_popup_title_single'] = '%s (%s)';
|
||||
$_['text_product_category'] = 'Category (incl. sub-categories)';
|
||||
$_['text_product_is_modified'] = 'Google Fields Edited';
|
||||
$_['text_product_model'] = 'Model';
|
||||
$_['text_product_name'] = 'Product';
|
||||
$_['text_refresh_token'] = 'Re-create token';
|
||||
$_['text_remote_cron'] = 'Method #2 - Remote CRON:';
|
||||
$_['text_report_campaign_name'] = 'Campaign Name';
|
||||
$_['text_report_clicks'] = 'Clicks';
|
||||
$_['text_report_conversion_value'] = 'Conversion Value';
|
||||
$_['text_report_conversions'] = 'Conversions';
|
||||
$_['text_report_cost'] = 'Cost';
|
||||
$_['text_report_date_range'] = 'Campaign Reports for %s';
|
||||
$_['text_report_impressions'] = 'Impressions';
|
||||
$_['text_report_status'] = 'Status';
|
||||
$_['text_reporting_interval'] = 'Reporting Time Interval';
|
||||
$_['text_reporting_interval_LAST_14_DAYS'] = 'Last 14 days';
|
||||
$_['text_reporting_interval_LAST_30_DAYS'] = 'Last 30 days';
|
||||
$_['text_reporting_interval_LAST_7_DAYS'] = 'Last 7 days';
|
||||
$_['text_reporting_interval_LAST_BUSINESS_WEEK'] = 'Last business week';
|
||||
$_['text_reporting_interval_LAST_WEEK'] = 'Last week';
|
||||
$_['text_reporting_interval_LAST_WEEK_SUN_SAT'] = 'Last week (Sunday - Saturday)';
|
||||
$_['text_reporting_interval_THIS_MONTH'] = 'This month';
|
||||
$_['text_reporting_interval_THIS_WEEK_MON_TODAY'] = 'This week (Monday - Today)';
|
||||
$_['text_reporting_interval_THIS_WEEK_SUN_TODAY'] = 'This week (Sunday - Today)';
|
||||
$_['text_reporting_interval_TODAY'] = 'Today';
|
||||
$_['text_reporting_interval_YESTERDAY'] = 'Yesterday';
|
||||
$_['text_select_country'] = '-- Country --';
|
||||
$_['text_select_currency'] = '-- Currency --';
|
||||
$_['text_select_language'] = '-- Language --';
|
||||
$_['text_selection_all'] = 'You have selected all <strong>{total}</strong> items on all pages. <a id="deselect_all_pages"><strong>Unselect Everything</strong></a>';
|
||||
$_['text_selection_page'] = 'You have selected <strong>{selected_page}</strong> item(s) on this page. <a id="select_all_pages"><strong>Click here</strong></a> to select all <strong>{total}</strong> items on all pages.';
|
||||
$_['text_shipping_carrier'] = 'Use a distribution center and carrier services';
|
||||
$_['text_shipping_custom'] = 'Set this up myself in the Google Merchant Center';
|
||||
$_['text_shipping_flat'] = 'Use a flat rate for all orders';
|
||||
$_['text_shipping_services'] = 'Shipping Services';
|
||||
$_['text_shipping_transit_times'] = 'Shipping Transit Times';
|
||||
$_['text_size'] = 'Size';
|
||||
$_['text_size_type_big_and_tall'] = 'Big & Tall';
|
||||
$_['text_size_type_maternity'] = 'Maternity';
|
||||
$_['text_size_type_petite'] = 'Petite';
|
||||
$_['text_size_type_plus'] = 'Plus';
|
||||
$_['text_size_type_regular'] = 'Regular';
|
||||
$_['text_status'] = 'Status';
|
||||
$_['text_suggestion'] = 'Suggestion';
|
||||
$_['text_tax_custom'] = 'Set this up myself in the Google Merchant Center';
|
||||
$_['text_tax_not_usa'] = 'I am not based in the USA';
|
||||
$_['text_tax_on_shipping'] = 'Add tax on shipping';
|
||||
$_['text_tax_usa'] = 'Use Google's destination-based tax estimation';
|
||||
$_['text_taxes'] = 'Taxes (USA only)';
|
||||
$_['text_tutorial_cron'] = 'https://isenselabs.com/posts/how-to-auto-sync-opencart-products-with-google-shopping';
|
||||
$_['text_usd'] = 'USD';
|
||||
$_['text_usd_day'] = 'USD / day';
|
||||
$_['text_video_tutorial_url_advertise'] = 'https://youtu.be/ZN7zz8raoVM?t=187';
|
||||
$_['text_video_tutorial_url_install'] = 'https://www.youtube.com/watch?v=AvkBLWAUojI';
|
||||
$_['text_video_tutorial_url_setup'] = 'https://www.youtube.com/watch?v=ZN7zz8raoVM';
|
||||
$_['text_view_issues'] = 'View Issues';
|
||||
$_['text_yes'] = 'Yes';
|
||||
|
||||
// Placeholders
|
||||
$_['placeholder_access_token'] = 'Paste your access token here';
|
||||
|
||||
// Tabs
|
||||
$_['tab_text_ads'] = 'Product Ads / Reports';
|
||||
$_['tab_text_reports'] = 'Campaign Reports';
|
||||
$_['tab_text_settings'] = 'Settings';
|
||||
|
||||
// Buttons
|
||||
$_['button_add_feed'] = 'New Feed';
|
||||
$_['button_add_target'] = 'New Campaign';
|
||||
$_['button_apply'] = 'Assign Selected Products to Campaigns';
|
||||
$_['button_bulk_edit_google_fields'] = 'Bulk Edit';
|
||||
$_['button_campaign'] = 'Smart Shopping Ad Campaigns';
|
||||
$_['button_close'] = 'Close';
|
||||
$_['button_connect'] = 'Connect';
|
||||
$_['button_disconnect'] = 'Disconnect';
|
||||
$_['button_mapping'] = 'Category Mapping';
|
||||
$_['button_proceed'] = 'Продолжить';
|
||||
$_['button_product_edit'] = 'Edit Google Fields';
|
||||
$_['button_product_set'] = 'Set Google Fields';
|
||||
$_['button_save'] = 'Save';
|
||||
$_['button_save_future'] = 'Save & Do Nothing';
|
||||
$_['button_save_modify'] = 'Save & Modify Current Products';
|
||||
$_['button_select_campaigns'] = 'Select Campaigns';
|
||||
$_['button_shipping_taxes'] = 'Shipping & Taxes';
|
||||
$_['button_video_tutorial_install'] = 'Посмотреть видео инструкцию (на английском)';
|
||||
$_['button_video_tutorial_setup'] = 'Посмотреть видео инструкцию (на английском)';
|
||||
|
||||
// Success
|
||||
$_['success_advertise_disable'] = 'Success! Advertising has been disabled for the selected products!';
|
||||
$_['success_advertise_enable'] = 'Success! Advertising has been enabled for the selected products!';
|
||||
$_['success_advertise_listed'] = 'The shopping ads are live! If your products are not yet approved, please allow up to 3 business days for the Merchant Center team to review them.';
|
||||
$_['success_advertise_unlisted'] = 'The shopping ads have been stopped. The products you edited no longer belong to any campaigns.';
|
||||
$_['success_campaign'] = 'Success! You have set up Smart Shopping Ad Campaigns!';
|
||||
$_['success_connect'] = 'Success! You have connected your extension!';
|
||||
$_['success_disconnect'] = 'Success! The extension has been disconnected!';
|
||||
$_['success_index'] = 'Success! You have modified the extension!';
|
||||
$_['success_mapping'] = 'Success! You have set up mapping!';
|
||||
$_['success_merchant'] = 'Success! Your Google Merchant Center account has been set up! Your website has been claimed!';
|
||||
$_['success_merchant_access'] = 'Success! Your Google Merchant Center account has been set up! Your website has been claimed! You can access the linked Google Merchant Center account from the <a href="https://merchants.google.com/mc/merchantdashboard?a=%s" target="_blank">Google Merchant Center dashboard</a>.';
|
||||
$_['success_product'] = 'Success! The product information has been updated.';
|
||||
$_['success_shipping_taxes'] = 'Success! The merchant shipping and taxes have been updated.';
|
||||
$_['success_target_add'] = 'Success! Your new campaign has been created! It will become active as soon as your product feeds get approved by Google Merchant Center.';
|
||||
$_['success_target_delete'] = 'Success! Your campaign has been deleted!';
|
||||
$_['success_target_edit'] = 'Success! You have edited your campaign!';
|
||||
|
||||
// Error
|
||||
$_['error_adblock'] = "It looks like you are using an ad blocker. In order to use GoogleShopping, please disable your ad blocker for your OpenCart admin panel.";
|
||||
$_['error_budget'] = 'Please insert the campaign budget. The value must be numeric and no less than 5.';
|
||||
$_['error_campaign_name_in_use'] = 'You are already using a campaign with the same name! Please choose another name.';
|
||||
$_['error_campaign_name_total'] = '"Total" is a forbidden name for a campaign! Please choose another name.';
|
||||
$_['error_carrier'] = 'Please select at least one carrier!';
|
||||
$_['error_carrier_postcode'] = 'Please provide the postcode for outgoing shipments.';
|
||||
$_['error_carrier_price_percentage'] = 'Please provide a valid price percentage from 0 to 100.';
|
||||
$_['error_cron_acknowledge'] = 'Please confirm you have set up a CRON job.';
|
||||
$_['error_empty_app_id'] = 'Please insert the App ID!';
|
||||
$_['error_empty_app_secret'] = 'Please insert the App Secret!';
|
||||
$_['error_empty_campaign_name'] = 'Please set a name for your campaign!';
|
||||
$_['error_empty_country'] = 'Please select a country!';
|
||||
$_['error_empty_feed'] = 'Please specify at least one campaign feed!';
|
||||
$_['error_field_no_value'] = 'Please provide a value!';
|
||||
$_['error_flat_rate'] = 'Please insert a flat rate value. The value must be numeric.';
|
||||
$_['error_form'] = 'Please check the form for errors and try to save agian.';
|
||||
$_['error_invalid_email'] = 'The provided e-mail address is not valid!';
|
||||
$_['error_invalid_feed'] = 'All feeds must have a language and currency!';
|
||||
$_['error_max_transit_time'] = 'Please insert a maximum transit time (number of days) which is larger than the minimum.';
|
||||
$_['error_min_transit_time'] = 'Please insert a minimum transit time (number of days).';
|
||||
$_['error_no_targets'] = 'Warning! No Smart Shopping Ad Campaigns have been set up.';
|
||||
$_['error_permission'] = 'Warning! You do not have permission to modify the extension Advertise > Google Shopping!';
|
||||
$_['error_popup_not_found_body'] = 'The system could not find the product.';
|
||||
$_['error_popup_not_found_title'] = 'Not found';
|
||||
$_['error_store_url_claim'] = 'Your store URL has been claimed by another app. Please connect your merchant account to re-claim the store URL.';
|
||||
$_['error_tax'] = 'Please select at least one taxable state.';
|
||||
$_['error_used_app_id'] = 'You have already connected this App with another one of your stores. Please disconnect the other store, or use a different App ID.';
|
||||
$_['error_warning'] = 'Warning! Please check the form carefully for errors.';
|
||||
|
||||
// Warning
|
||||
$_['warning_budget'] = 'Campaigns with a daily budget of less than $10 may not yield good conversion results. For best results, we suggest a daily budget of at least $10.';
|
||||
$_['warning_disabled'] = 'The extension is disabled and all of your campaigns are stopped. Enable the extension to activate the Smart Shopping Ad Campaigns.';
|
||||
$_['warning_last_cron_executed'] = 'It seems like your CRON task has not been run recently. Please ensure it is set up correctly. Follow <a href="%s" target="_blank"><strong>this tutorial</strong></a> to see how to do it.';
|
||||
$_['warning_no_active_campaigns'] = 'You have no campaigns running. <a href="%s"><strong>Click here</strong></a> to activate your campaign.';
|
||||
$_['warning_no_advertised_products'] = 'No products are being advertised. To start advertising, you must assign products to campaigns. Follow <a href="%s" target="_blank"><strong>this tutorial</strong></a> to see how to do it.';
|
||||
$_['warning_roas'] = 'Google Ads needs about a couple of weeks after a campaign gets created to work properly with ROAS. Please check back on %s to configure this setting.';
|
||||
@@ -1,17 +0,0 @@
|
||||
<?php
|
||||
$_['heading_title'] = 'Google Analytics';
|
||||
|
||||
// Text
|
||||
$_['text_extension'] = 'Extensions';
|
||||
$_['text_success'] = 'Success: You have modified Google Analytics!';
|
||||
$_['text_edit'] = 'Edit Google Analytics';
|
||||
$_['text_signup'] = 'Login to your <a href="http://www.google.com/analytics/" target="_blank"><u>Google Analytics</u></a> account and after creating your website profile copy and paste the analytics code into this field.';
|
||||
$_['text_default'] = 'Default';
|
||||
|
||||
// Entry
|
||||
$_['entry_code'] = 'Google Analytics Code';
|
||||
$_['entry_status'] = 'Status';
|
||||
|
||||
// Error
|
||||
$_['error_permission'] = 'Warning: You do not have permission to modify Google Analytics!';
|
||||
$_['error_code'] = 'Code required!';
|
||||
@@ -1,21 +0,0 @@
|
||||
<?php
|
||||
// * @source See SOURCE.txt for source and other copyright.
|
||||
// * @license GNU General Public License version 3; see LICENSE.txt
|
||||
|
||||
$_['heading_title'] = 'Google reCAPTCHA';
|
||||
|
||||
// Text
|
||||
$_['text_captcha'] = 'Капча';
|
||||
$_['text_success'] = 'Настройки успешно изменены!';
|
||||
$_['text_edit'] = 'Настройки Google reCAPTCHA';
|
||||
$_['text_signup'] = 'Перейдите <a href="https://www.google.com/recaptcha/intro/index.html" target="_blank"><u>Google reCAPTCHA</u></a> и зарегистрируйте свой магазин.';
|
||||
|
||||
// Entry
|
||||
$_['entry_key'] = 'Ключ сайта';
|
||||
$_['entry_secret'] = 'Секретный ключ';
|
||||
$_['entry_status'] = 'Статус';
|
||||
|
||||
// Error
|
||||
$_['error_permission'] = 'У вас недостаточно прав для внесения изменений!';
|
||||
$_['error_key'] = 'Необходим ключ сайта!';
|
||||
$_['error_secret'] = 'Необходим секретный ключ!';
|
||||
@@ -1,697 +0,0 @@
|
||||
<?php
|
||||
|
||||
use \googleshopping\exception\Connection as ConnectionException;
|
||||
use \googleshopping\Googleshopping;
|
||||
|
||||
class ModelExtensionAdvertiseGoogle extends Model {
|
||||
private $events = array(
|
||||
'admin/view/common/column_left/before' => array(
|
||||
'extension/advertise/google/admin_link',
|
||||
),
|
||||
'admin/model/catalog/product/addProduct/after' => array(
|
||||
'extension/advertise/google/addProduct',
|
||||
),
|
||||
'admin/model/catalog/product/copyProduct/after' => array(
|
||||
'extension/advertise/google/copyProduct',
|
||||
),
|
||||
'admin/model/catalog/product/deleteProduct/after' => array(
|
||||
'extension/advertise/google/deleteProduct',
|
||||
),
|
||||
'catalog/controller/checkout/success/before' => array(
|
||||
'extension/advertise/google/before_checkout_success'
|
||||
),
|
||||
'store/view/common/header/after' => array(
|
||||
'extension/advertise/google/google_global_site_tag'
|
||||
),
|
||||
'store/view/common/success/after' => array(
|
||||
'extension/advertise/google/google_dynamic_remarketing_purchase'
|
||||
),
|
||||
'store/view/product/product/after' => array(
|
||||
'extension/advertise/google/google_dynamic_remarketing_product'
|
||||
),
|
||||
'store/view/product/search/after' => array(
|
||||
'extension/advertise/google/google_dynamic_remarketing_searchresults'
|
||||
),
|
||||
'store/view/product/category/after' => array(
|
||||
'extension/advertise/google/google_dynamic_remarketing_category'
|
||||
),
|
||||
'store/view/common/home/after' => array(
|
||||
'extension/advertise/google/google_dynamic_remarketing_home'
|
||||
),
|
||||
'store/view/checkout/cart/after' => array(
|
||||
'extension/advertise/google/google_dynamic_remarketing_cart'
|
||||
)
|
||||
);
|
||||
|
||||
private $rename_tables = array(
|
||||
'advertise_google_target' => 'googleshopping_target',
|
||||
'category_to_google_product_category' => 'googleshopping_category',
|
||||
'product_advertise_google_status' => 'googleshopping_product_status',
|
||||
'product_advertise_google_target' => 'googleshopping_product_target',
|
||||
'product_advertise_google' => 'googleshopping_product'
|
||||
);
|
||||
|
||||
private $table_columns = array(
|
||||
'googleshopping_target' => array(
|
||||
'advertise_google_target_id',
|
||||
'store_id',
|
||||
'campaign_name',
|
||||
'country',
|
||||
'budget',
|
||||
'feeds',
|
||||
'status'
|
||||
),
|
||||
'googleshopping_category' => array(
|
||||
'google_product_category',
|
||||
'store_id',
|
||||
'category_id'
|
||||
),
|
||||
'googleshopping_product_status' => array(
|
||||
'product_id',
|
||||
'store_id',
|
||||
'product_variation_id',
|
||||
'destination_statuses',
|
||||
'data_quality_issues',
|
||||
'item_level_issues',
|
||||
'google_expiration_date'
|
||||
),
|
||||
'googleshopping_product_target' => array(
|
||||
'product_id',
|
||||
'store_id',
|
||||
'advertise_google_target_id'
|
||||
),
|
||||
'googleshopping_product' => array(
|
||||
'product_advertise_google_id',
|
||||
'product_id',
|
||||
'store_id',
|
||||
'has_issues',
|
||||
'destination_status',
|
||||
'impressions',
|
||||
'clicks',
|
||||
'conversions',
|
||||
'cost',
|
||||
'conversion_value',
|
||||
'google_product_category',
|
||||
'condition',
|
||||
'adult',
|
||||
'multipack',
|
||||
'is_bundle',
|
||||
'age_group',
|
||||
'color',
|
||||
'gender',
|
||||
'size_type',
|
||||
'size_system',
|
||||
'size',
|
||||
'is_modified'
|
||||
)
|
||||
);
|
||||
|
||||
public function isAppIdUsed($app_id, $store_id) {
|
||||
$sql = "SELECT `store_id` FROM `" . DB_PREFIX . "setting` WHERE `key`='advertise_google_app_id' AND `value`='" . $this->db->escape($store_id) . "' AND `store_id`!=" . (int)$store_id . " LIMIT 1";
|
||||
|
||||
$result = $this->db->query($sql);
|
||||
|
||||
if ($result->num_rows > 0) {
|
||||
try {
|
||||
$googleshopping = new Googleshopping($this->registry, (int)$result->row['store_id']);
|
||||
|
||||
return $googleshopping->isConnected();
|
||||
} catch (\RuntimeException $e) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public function getFinalProductId() {
|
||||
$sql = "SELECT product_id FROM `" . DB_PREFIX . "product` ORDER BY product_id DESC LIMIT 1";
|
||||
|
||||
$result = $this->db->query($sql);
|
||||
|
||||
if ($result->num_rows > 0) {
|
||||
return (int)$result->row['product_id'];
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public function isAnyProductCategoryModified($store_id) {
|
||||
$sql = "SELECT pag.is_modified FROM `" . DB_PREFIX . "googleshopping_product` pag WHERE pag.google_product_category IS NOT NULL AND pag.store_id=" . (int)$store_id . " LIMIT 0,1";
|
||||
|
||||
return $this->db->query($sql)->num_rows > 0;
|
||||
}
|
||||
|
||||
public function getAdvertisedCount($store_id) {
|
||||
$result = $this->db->query("SELECT COUNT(product_id) as total FROM `" . DB_PREFIX . "googleshopping_product_target` WHERE store_id=" . (int)$store_id . " GROUP BY `product_id`");
|
||||
|
||||
return $result->num_rows > 0 ? (int)$result->row['total'] : 0;
|
||||
}
|
||||
|
||||
public function getMapping($store_id) {
|
||||
$sql = "SELECT * FROM `" . DB_PREFIX . "googleshopping_category` WHERE store_id=" . (int)$store_id;
|
||||
|
||||
return $this->db->query($sql)->rows;
|
||||
}
|
||||
|
||||
public function setCategoryMapping($google_product_category, $store_id, $category_id) {
|
||||
$sql = "INSERT INTO `" . DB_PREFIX . "googleshopping_category` SET `google_product_category`='" . $this->db->escape($google_product_category) . "', `store_id`=" . (int)$store_id . ", `category_id`=" . (int)$category_id . " ON DUPLICATE KEY UPDATE `category_id`=" . (int)$category_id;
|
||||
|
||||
$this->db->query($sql);
|
||||
}
|
||||
|
||||
public function getMappedCategory($google_product_category, $store_id) {
|
||||
$sql = "SELECT GROUP_CONCAT(cd.name ORDER BY cp.level SEPARATOR ' > ') AS name, cp.category_id FROM " . DB_PREFIX . "category_path cp LEFT JOIN " . DB_PREFIX . "category_description cd ON (cp.path_id = cd.category_id) LEFT JOIN `" . DB_PREFIX . "googleshopping_category` c2gpc ON (c2gpc.category_id = cp.category_id) WHERE cd.language_id=" . (int)$this->config->get('config_language_id') . " AND c2gpc.google_product_category='" . $this->db->escape($google_product_category) . "' AND c2gpc.store_id=" . (int)$store_id;
|
||||
|
||||
$result = $this->db->query($sql);
|
||||
|
||||
if ($result->num_rows > 0) {
|
||||
return $result->row;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public function getProductByProductAdvertiseGoogleId($product_advertise_google_id) {
|
||||
$sql = "SELECT pag.product_id FROM `" . DB_PREFIX . "googleshopping_product` pag WHERE pag.product_advertise_google_id=" . (int)$product_advertise_google_id;
|
||||
|
||||
$result = $this->db->query($sql);
|
||||
|
||||
if ($result->num_rows) {
|
||||
$this->load->model('catalog/product');
|
||||
|
||||
return $this->model_catalog_product->getProduct($result->row['product_id']);
|
||||
}
|
||||
}
|
||||
|
||||
public function getProductAdvertiseGoogle($product_advertise_google_id) {
|
||||
$sql = "SELECT pag.* FROM `" . DB_PREFIX . "googleshopping_product` pag WHERE pag.product_advertise_google_id=" . (int)$product_advertise_google_id;
|
||||
|
||||
return $this->db->query($sql)->row;
|
||||
}
|
||||
|
||||
public function hasActiveTarget($store_id) {
|
||||
$sql = "SELECT agt.advertise_google_target_id FROM `" . DB_PREFIX . "googleshopping_target` agt WHERE agt.store_id=" . (int)$store_id . " AND agt.status='active' LIMIT 1";
|
||||
|
||||
return $this->db->query($sql)->num_rows > 0;
|
||||
}
|
||||
|
||||
public function getRequiredFieldsByProductIds($product_ids, $store_id) {
|
||||
$this->load->config('googleshopping/googleshopping');
|
||||
|
||||
$result = array();
|
||||
$countries = $this->getTargetCountriesByProductIds($product_ids, $store_id);
|
||||
|
||||
foreach ($countries as $country) {
|
||||
foreach ($this->config->get('advertise_google_country_required_fields') as $field => $requirements) {
|
||||
if (
|
||||
(!empty($requirements['countries']) && in_array($country, $requirements['countries']))
|
||||
||
|
||||
(is_array($requirements['countries']) && empty($requirements['countries']))
|
||||
) {
|
||||
$result[$field] = $requirements;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
public function getRequiredFieldsByFilter($data, $store_id) {
|
||||
$this->load->config('googleshopping/googleshopping');
|
||||
|
||||
$result = array();
|
||||
$countries = $this->getTargetCountriesByFilter($data, $store_id);
|
||||
|
||||
foreach ($countries as $country) {
|
||||
foreach ($this->config->get('advertise_google_country_required_fields') as $field => $requirements) {
|
||||
if (
|
||||
(!empty($requirements['countries']) && in_array($country, $requirements['countries']))
|
||||
||
|
||||
(is_array($requirements['countries']) && empty($requirements['countries']))
|
||||
) {
|
||||
$result[$field] = $requirements;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
public function getTargetCountriesByProductIds($product_ids, $store_id) {
|
||||
$sql = "SELECT DISTINCT agt.country FROM `" . DB_PREFIX . "googleshopping_product_target` pagt LEFT JOIN `" . DB_PREFIX . "googleshopping_target` agt ON (agt.advertise_google_target_id = pagt.advertise_google_target_id AND agt.store_id = pagt.store_id) WHERE pagt.product_id IN (" . $this->googleshopping->productIdsToIntegerExpression($product_ids) . ") AND pagt.store_id=" . (int)$store_id;
|
||||
|
||||
return array_map(array($this, 'country'), $this->db->query($sql)->rows);
|
||||
}
|
||||
|
||||
public function getTargetCountriesByFilter($data, $store_id) {
|
||||
$sql = "SELECT DISTINCT agt.country FROM `" . DB_PREFIX . "googleshopping_product_target` pagt LEFT JOIN `" . DB_PREFIX . "googleshopping_target` agt ON (agt.advertise_google_target_id = pagt.advertise_google_target_id AND agt.store_id = pagt.store_id) LEFT JOIN `" . DB_PREFIX . "product` p ON (pagt.product_id = p.product_id) LEFT JOIN `" . DB_PREFIX . "product_description` pd ON (pd.product_id = pagt.product_id) WHERE pagt.store_id=" . (int)$store_id . " AND pd.language_id=" . (int)$this->config->get('config_language_id');
|
||||
|
||||
$this->googleshopping->applyFilter($sql, $data);
|
||||
|
||||
return array_map(array($this, 'country'), $this->db->query($sql)->rows);
|
||||
}
|
||||
|
||||
public function getProductOptionsByProductIds($product_ids) {
|
||||
$sql = "SELECT po.option_id, od.name FROM `" . DB_PREFIX . "product_option` po LEFT JOIN `" . DB_PREFIX . "option_description` od ON (od.option_id=po.option_id AND od.language_id=" . (int)$this->config->get('config_language_id') . ") LEFT JOIN `" . DB_PREFIX . "option` o ON (o.option_id = po.option_id) WHERE o.type IN ('select', 'radio') AND po.product_id IN (" . $this->googleshopping->productIdsToIntegerExpression($product_ids) . ")";
|
||||
|
||||
return $this->db->query($sql)->rows;
|
||||
}
|
||||
|
||||
public function getProductOptionsByFilter($data) {
|
||||
$sql = "SELECT DISTINCT po.option_id, od.name FROM `" . DB_PREFIX . "product_option` po LEFT JOIN `" . DB_PREFIX . "option_description` od ON (od.option_id=po.option_id AND od.language_id=" . (int)$this->config->get('config_language_id') . ") LEFT JOIN `" . DB_PREFIX . "option` o ON (o.option_id = po.option_id) LEFT JOIN `" . DB_PREFIX . "product` p ON (po.product_id = p.product_id) LEFT JOIN `" . DB_PREFIX . "product_description` pd ON (pd.product_id = po.product_id) WHERE o.type IN ('select', 'radio') AND pd.language_id=" . (int)$this->config->get('config_language_id');
|
||||
|
||||
$this->googleshopping->applyFilter($sql, $data);
|
||||
|
||||
return $this->db->query($sql)->rows;
|
||||
}
|
||||
|
||||
public function addTarget($target, $store_id) {
|
||||
$sql = "INSERT INTO `" . DB_PREFIX . "googleshopping_target` SET `store_id`=" . (int)$store_id . ", `campaign_name`='" . $this->db->escape($target['campaign_name']) . "', `country`='" . $this->db->escape($target['country']) . "', `budget`='" . (float)$target['budget'] . "', `feeds`='" . $this->db->escape(json_encode($target['feeds'])) . "', `date_added`=NOW(), `roas`=" . (int)$target['roas'] . " , `status`='" . $this->db->escape($target['status']) . "'";
|
||||
|
||||
$this->db->query($sql);
|
||||
|
||||
return $this->db->getLastId();
|
||||
}
|
||||
|
||||
public function deleteProducts($product_ids) {
|
||||
$sql = "DELETE FROM `" . DB_PREFIX . "googleshopping_product` WHERE `product_id` IN (" . $this->googleshopping->productIdsToIntegerExpression($product_ids) . ")";
|
||||
|
||||
$this->db->query($sql);
|
||||
|
||||
$sql = "DELETE FROM `" . DB_PREFIX . "googleshopping_product_target` WHERE `product_id` IN (" . $this->googleshopping->productIdsToIntegerExpression($product_ids) . ")";
|
||||
|
||||
$this->db->query($sql);
|
||||
|
||||
$sql = "DELETE FROM `" . DB_PREFIX . "googleshopping_product_status` WHERE `product_id` IN (" . $this->googleshopping->productIdsToIntegerExpression($product_ids) . ")";
|
||||
|
||||
$this->db->query($sql);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public function setAdvertisingBySelect($post_product_ids, $post_target_ids, $store_id) {
|
||||
if (!empty($post_product_ids)) {
|
||||
$product_ids = array_map(array($this->googleshopping, 'integer'), $post_product_ids);
|
||||
|
||||
$product_ids_expression = implode(',', $product_ids);
|
||||
|
||||
$this->db->query("DELETE FROM `" . DB_PREFIX . "googleshopping_product_target` WHERE product_id IN (" . $product_ids_expression . ") AND store_id=" . (int)$store_id);
|
||||
|
||||
if (!empty($post_target_ids)) {
|
||||
$target_ids = array_map(array($this->googleshopping, 'integer'), $post_target_ids);
|
||||
|
||||
$values = array();
|
||||
|
||||
foreach ($product_ids as $product_id) {
|
||||
foreach ($target_ids as $target_id) {
|
||||
$values[] = '(' . $product_id . ',' . $store_id . ',' . $target_id . ')';
|
||||
}
|
||||
}
|
||||
|
||||
$sql = "INSERT INTO `" . DB_PREFIX . "googleshopping_product_target` (`product_id`, `store_id`, `advertise_google_target_id`) VALUES " . implode(',', $values);
|
||||
|
||||
$this->db->query($sql);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function setAdvertisingByFilter($data, $post_target_ids, $store_id) {
|
||||
$sql = "DELETE pagt FROM `" . DB_PREFIX . "googleshopping_product_target` pagt LEFT JOIN `" . DB_PREFIX . "product` p ON (pagt.product_id = p.product_id) LEFT JOIN `" . DB_PREFIX . "product_description` pd ON (pd.product_id = p.product_id) WHERE pd.language_id=" . (int)$this->config->get('config_language_id');
|
||||
|
||||
$this->googleshopping->applyFilter($sql, $data);
|
||||
|
||||
$this->db->query($sql);
|
||||
|
||||
if (!empty($post_target_ids)) {
|
||||
$target_ids = array_map(array($this->googleshopping, 'integer'), $post_target_ids);
|
||||
|
||||
$insert_sql = "SELECT p.product_id, " . (int)$store_id . " as store_id, '{TARGET_ID}' as advertise_google_target_id FROM `" . DB_PREFIX . "product` p LEFT JOIN `" . DB_PREFIX . "product_description` pd ON (pd.product_id = p.product_id) WHERE pd.language_id=" . (int)$this->config->get('config_language_id');
|
||||
|
||||
$this->googleshopping->applyFilter($insert_sql, $data);
|
||||
|
||||
foreach ($target_ids as $target_id) {
|
||||
$sql = "INSERT INTO `" . DB_PREFIX . "googleshopping_product_target` (`product_id`, `store_id`, `advertise_google_target_id`) " . str_replace('{TARGET_ID}', (string)$target_id, $insert_sql);
|
||||
|
||||
$this->db->query($sql);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function insertNewProducts($product_ids = array(), $store_id) {
|
||||
$sql = "INSERT INTO `" . DB_PREFIX . "googleshopping_product` (`product_id`, `store_id`, `google_product_category`) SELECT p.product_id, p2s.store_id, (SELECT c2gpc.google_product_category FROM `" . DB_PREFIX . "product_to_category` p2c LEFT JOIN `" . DB_PREFIX . "category_path` cp ON (p2c.category_id = cp.category_id) LEFT JOIN `" . DB_PREFIX . "googleshopping_category` c2gpc ON (c2gpc.category_id = cp.path_id AND c2gpc.store_id = " . (int)$store_id . ") WHERE p2c.product_id = p.product_id AND c2gpc.google_product_category IS NOT NULL ORDER BY cp.level DESC LIMIT 0,1) as `google_product_category` FROM `" . DB_PREFIX . "product` p LEFT JOIN `" . DB_PREFIX . "product_to_store` p2s ON (p2s.product_id = p.product_id AND p2s.store_id = " . (int)$store_id . ") LEFT JOIN `" . DB_PREFIX . "googleshopping_product` pag ON (pag.product_id = p.product_id AND pag.store_id=p2s.store_id) WHERE pag.product_id IS NULL AND p2s.store_id IS NOT NULL";
|
||||
|
||||
if (!empty($product_ids)) {
|
||||
$sql .= " AND p.product_id IN (" . $this->googleshopping->productIdsToIntegerExpression($product_ids) . ")";
|
||||
}
|
||||
|
||||
$this->db->query($sql);
|
||||
}
|
||||
|
||||
public function updateGoogleProductCategoryMapping($store_id) {
|
||||
$sql = "INSERT INTO `" . DB_PREFIX . "googleshopping_product` (`product_id`, `store_id`, `google_product_category`) SELECT p.product_id, " . (int)$store_id . " as store_id, (SELECT c2gpc.google_product_category FROM `" . DB_PREFIX . "product_to_category` p2c LEFT JOIN `" . DB_PREFIX . "category_path` cp ON (p2c.category_id = cp.category_id) LEFT JOIN `" . DB_PREFIX . "googleshopping_category` c2gpc ON (c2gpc.category_id = cp.path_id AND c2gpc.store_id = " . (int)$store_id . ") WHERE p2c.product_id = p.product_id AND c2gpc.google_product_category IS NOT NULL ORDER BY cp.level DESC LIMIT 0,1) as `google_product_category` FROM `" . DB_PREFIX . "product` p LEFT JOIN `" . DB_PREFIX . "googleshopping_product` pag ON (pag.product_id = p.product_id) WHERE pag.product_id IS NOT NULL ON DUPLICATE KEY UPDATE `google_product_category`=VALUES(`google_product_category`)";
|
||||
|
||||
$this->db->query($sql);
|
||||
}
|
||||
|
||||
public function updateSingleProductFields($data) {
|
||||
$values = array();
|
||||
|
||||
$entry = array();
|
||||
$entry['product_id'] = (int)$data['product_id'];
|
||||
$entry = array_merge($entry, $this->makeInsertData($data));
|
||||
|
||||
$values[] = "(" . implode(",", $entry) . ")";
|
||||
|
||||
$sql = "INSERT INTO `" . DB_PREFIX . "googleshopping_product` (`product_id`, `store_id`, `google_product_category`, `condition`, `adult`, `multipack`, `is_bundle`, `age_group`, `color`, `gender`, `size_type`, `size_system`, `size`, `is_modified`) VALUES " . implode(',', $values) . " ON DUPLICATE KEY UPDATE " . $this->makeOnDuplicateKeyData();
|
||||
|
||||
$this->db->query($sql);
|
||||
}
|
||||
|
||||
public function updateMultipleProductFields($filter_data, $data) {
|
||||
$insert_sql = "SELECT p.product_id, {INSERT_DATA} FROM `" . DB_PREFIX . "product` p LEFT JOIN `" . DB_PREFIX . "product_description` pd ON (pd.product_id = p.product_id) WHERE pd.language_id=" . (int)$this->config->get('config_language_id');
|
||||
|
||||
$this->googleshopping->applyFilter($insert_sql, $filter_data);
|
||||
|
||||
$insert_data = array();
|
||||
$keys[] = "`product_id`";
|
||||
|
||||
foreach ($this->makeInsertData($data) as $key => $value) {
|
||||
$insert_data[] = $value . " as `" . $key . "`";
|
||||
$keys[] = "`" . $key . "`";
|
||||
}
|
||||
|
||||
$sql = "INSERT INTO `" . DB_PREFIX . "googleshopping_product` (" . implode(", ", $keys) . ") " . str_replace('{INSERT_DATA}', implode(", ", $insert_data), $insert_sql) . " ON DUPLICATE KEY UPDATE " . $this->makeOnDuplicateKeyData();
|
||||
|
||||
$this->db->query($sql);
|
||||
}
|
||||
|
||||
protected function makeInsertData($data) {
|
||||
$insert_data = array();
|
||||
|
||||
$insert_data['store_id'] = (int)$data['store_id'];
|
||||
$insert_data['google_product_category'] = "'" . $this->db->escape($data['google_product_category']) . "'";
|
||||
$insert_data['condition'] = "'" . $this->db->escape($data['condition']) . "'";
|
||||
$insert_data['adult'] = (int)$data['adult'];
|
||||
$insert_data['multipack'] = (int)$data['multipack'];
|
||||
$insert_data['is_bundle'] = (int)$data['is_bundle'];
|
||||
$insert_data['age_group'] = "'" . $this->db->escape($data['age_group']) . "'";
|
||||
$insert_data['color'] = (int)$data['color'];
|
||||
$insert_data['gender'] = "'" . $this->db->escape($data['gender']) . "'";
|
||||
$insert_data['size_type'] = "'" . $this->db->escape($data['size_type']) . "'";
|
||||
$insert_data['size_system'] = "'" . $this->db->escape($data['size_system']) . "'";
|
||||
$insert_data['size'] = (int)$data['size'];
|
||||
$insert_data['is_modified'] = 1;
|
||||
|
||||
return $insert_data;
|
||||
}
|
||||
|
||||
protected function makeOnDuplicateKeyData() {
|
||||
return "`google_product_category`=VALUES(`google_product_category`), `condition`=VALUES(`condition`), `adult`=VALUES(`adult`), `multipack`=VALUES(`multipack`), `is_bundle`=VALUES(`is_bundle`), `age_group`=VALUES(`age_group`), `color`=VALUES(`color`), `gender`=VALUES(`gender`), `size_type`=VALUES(`size_type`), `size_system`=VALUES(`size_system`), `size`=VALUES(`size`), `is_modified`=VALUES(`is_modified`)";
|
||||
}
|
||||
|
||||
public function getCategories($data = array(), $store_id) {
|
||||
$sql = "SELECT cp.category_id AS category_id, GROUP_CONCAT(cd1.name ORDER BY cp.level SEPARATOR ' > ') AS name, c1.parent_id, c1.sort_order FROM " . DB_PREFIX . "category_path cp LEFT JOIN `" . DB_PREFIX . "category_to_store` c2s ON (c2s.category_id = cp.category_id AND c2s.store_id=" . (int)$store_id . ") LEFT JOIN " . DB_PREFIX . "category c1 ON (cp.category_id = c1.category_id) LEFT JOIN " . DB_PREFIX . "category c2 ON (cp.path_id = c2.category_id) LEFT JOIN " . DB_PREFIX . "category_description cd1 ON (cp.path_id = cd1.category_id) LEFT JOIN " . DB_PREFIX . "category_description cd2 ON (cp.category_id = cd2.category_id) WHERE c2s.store_id IS NOT NULL AND cd1.language_id = '" . (int)$this->config->get('config_language_id') . "' AND cd2.language_id = '" . (int)$this->config->get('config_language_id') . "'";
|
||||
|
||||
if (!empty($data['filter_name'])) {
|
||||
$sql .= " AND cd2.name LIKE '%" . $this->db->escape($data['filter_name']) . "%'";
|
||||
}
|
||||
|
||||
$sql .= " GROUP BY cp.category_id";
|
||||
|
||||
$sort_data = array(
|
||||
'name',
|
||||
'sort_order'
|
||||
);
|
||||
|
||||
if (isset($data['sort']) && in_array($data['sort'], $sort_data)) {
|
||||
$sql .= " ORDER BY " . $data['sort'];
|
||||
} else {
|
||||
$sql .= " ORDER BY sort_order";
|
||||
}
|
||||
|
||||
if (isset($data['order']) && ($data['order'] == 'DESC')) {
|
||||
$sql .= " DESC";
|
||||
} else {
|
||||
$sql .= " ASC";
|
||||
}
|
||||
|
||||
if (isset($data['start']) || isset($data['limit'])) {
|
||||
if ($data['start'] < 0) {
|
||||
$data['start'] = 0;
|
||||
}
|
||||
|
||||
if ($data['limit'] < 1) {
|
||||
$data['limit'] = 20;
|
||||
}
|
||||
|
||||
$sql .= " LIMIT " . (int)$data['start'] . "," . (int)$data['limit'];
|
||||
}
|
||||
|
||||
$query = $this->db->query($sql);
|
||||
|
||||
return $query->rows;
|
||||
}
|
||||
|
||||
public function getProductCampaigns($product_id, $store_id) {
|
||||
$sql = "SELECT agt.advertise_google_target_id, agt.campaign_name FROM `" . DB_PREFIX . "googleshopping_product_target` pagt LEFT JOIN `" . DB_PREFIX . "googleshopping_target` agt ON (pagt.advertise_google_target_id = agt.advertise_google_target_id) WHERE pagt.product_id=" . (int)$product_id . " AND pagt.store_id=" . (int)$store_id;
|
||||
|
||||
return $this->db->query($sql)->rows;
|
||||
}
|
||||
|
||||
public function getProductIssues($product_id, $store_id) {
|
||||
$this->load->model('localisation/language');
|
||||
|
||||
$sql = "SELECT pag.color, pag.size, pd.name, p.model FROM `" . DB_PREFIX . "googleshopping_product` pag LEFT JOIN `" . DB_PREFIX . "product` p ON (p.product_id = pag.product_id) LEFT JOIN `" . DB_PREFIX . "product_description` pd ON (pd.product_id = pag.product_id AND pd.language_id=" . (int)$this->config->get('config_language_id') . ") WHERE pag.product_id=" . (int)$product_id . " AND pag.store_id=" . (int)$store_id;
|
||||
|
||||
$product_info = $this->db->query($sql)->row;
|
||||
|
||||
if (!empty($product_info)) {
|
||||
$result = array();
|
||||
$result['name'] = $product_info['name'];
|
||||
$result['model'] = $product_info['model'];
|
||||
$result['entries'] = array();
|
||||
|
||||
foreach ($this->model_localisation_language->getLanguages() as $language) {
|
||||
$language_id = $language['language_id'];
|
||||
$groups = $this->googleshopping->getGroups($product_id, $language_id, $product_info['color'], $product_info['size']);
|
||||
|
||||
$result['entries'][$language_id] = array(
|
||||
'language_name' => $language['name'],
|
||||
'issues' => array()
|
||||
);
|
||||
|
||||
foreach ($groups as $id => $group) {
|
||||
$issues = $this->db->query("SELECT * FROM `" . DB_PREFIX . "googleshopping_product_status` WHERE product_id=" . (int)$product_id . " AND store_id=" . (int)$store_id . " AND product_variation_id='" . $this->db->escape($id) . "'")->row;
|
||||
|
||||
$destination_statuses = !empty($issues['destination_statuses']) ? json_decode($issues['destination_statuses'], true) : array();
|
||||
$data_quality_issues = !empty($issues['data_quality_issues']) ? json_decode($issues['data_quality_issues'], true) : array();
|
||||
$item_level_issues = !empty($issues['item_level_issues']) ? json_decode($issues['item_level_issues'], true) : array();
|
||||
$google_expiration_date = !empty($issues['google_expiration_date']) ? date($this->language->get('datetime_format'), $issues['google_expiration_date']) : $this->language->get('text_na');
|
||||
|
||||
$result['entries'][$language_id]['issues'][] = array(
|
||||
'color' => $group['color'] != "" ? $group['color'] : $this->language->get('text_na'),
|
||||
'size' => $group['size'] != "" ? $group['size'] : $this->language->get('text_na'),
|
||||
'destination_statuses' => $destination_statuses,
|
||||
'data_quality_issues' => $data_quality_issues,
|
||||
'item_level_issues' => $item_level_issues,
|
||||
'google_expiration_date' => $google_expiration_date
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/*
|
||||
* Shortly after releasing the extension,
|
||||
* we learned that the table names are actually
|
||||
* clashing with third-party extensions.
|
||||
* Hence, this renaming script was created.
|
||||
*/
|
||||
public function renameTables() {
|
||||
foreach ($this->rename_tables as $old_table => $new_table) {
|
||||
$new_table_name = DB_PREFIX . $new_table;
|
||||
$old_table_name = DB_PREFIX . $old_table;
|
||||
|
||||
if ($this->tableExists($old_table_name) && !$this->tableExists($new_table_name) && $this->tableColumnsMatch($old_table_name, $this->table_columns[$new_table])) {
|
||||
$this->db->query("RENAME TABLE `" . $old_table_name . "` TO `" . $new_table_name . "`");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private function tableExists($table) {
|
||||
return $this->db->query("SHOW TABLES LIKE '" . $table . "'")->num_rows > 0;
|
||||
}
|
||||
|
||||
private function tableColumnsMatch($table, $columns) {
|
||||
$num_columns = $this->db->query("SHOW COLUMNS FROM `" . $table . "` WHERE Field IN (" . implode(',', $this->wrap($columns, '"')) . ")")->num_rows;
|
||||
|
||||
return $num_columns == count($columns);
|
||||
}
|
||||
|
||||
private function wrap($text, $char) {
|
||||
if (is_array($text)) {
|
||||
foreach ($text as &$string) {
|
||||
$string = $char . $string . $char;
|
||||
}
|
||||
|
||||
return $text;
|
||||
} else {
|
||||
return $char . $text . $char;
|
||||
}
|
||||
}
|
||||
|
||||
public function createTables() {
|
||||
$this->db->query("CREATE TABLE IF NOT EXISTS `" . DB_PREFIX . "googleshopping_product` (
|
||||
`product_advertise_google_id` INT(11) UNSIGNED NOT NULL AUTO_INCREMENT,
|
||||
`product_id` INT(11),
|
||||
`store_id` INT(11) NOT NULL DEFAULT '0',
|
||||
`has_issues` TINYINT(1),
|
||||
`destination_status` ENUM('pending','approved','disapproved') NOT NULL DEFAULT 'pending',
|
||||
`impressions` INT(11) NOT NULL DEFAULT '0',
|
||||
`clicks` INT(11) NOT NULL DEFAULT '0',
|
||||
`conversions` INT(11) NOT NULL DEFAULT '0.0000',
|
||||
`cost` decimal(15,4) NOT NULL DEFAULT '0.0000',
|
||||
`conversion_value` decimal(15,4) NOT NULL DEFAULT '0.0000',
|
||||
`google_product_category` VARCHAR(10),
|
||||
`condition` ENUM('new','refurbished','used'),
|
||||
`adult` TINYINT(1),
|
||||
`multipack` INT(11),
|
||||
`is_bundle` TINYINT(1),
|
||||
`age_group` ENUM('newborn','infant','toddler','kids','adult'),
|
||||
`color` INT(11),
|
||||
`gender` ENUM('male','female','unisex'),
|
||||
`size_type` ENUM('regular','petite','plus','big and tall','maternity'),
|
||||
`size_system` ENUM('AU','BR','CN','DE','EU','FR','IT','JP','MEX','UK','US'),
|
||||
`size` INT(11),
|
||||
`is_modified` TINYINT(1) NOT NULL DEFAULT '0',
|
||||
PRIMARY KEY (`product_advertise_google_id`),
|
||||
UNIQUE `product_id_store_id` (`product_id`, `store_id`)
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=utf8");
|
||||
|
||||
$this->db->query("CREATE TABLE IF NOT EXISTS `" . DB_PREFIX . "googleshopping_product_status` (
|
||||
`product_id` INT(11),
|
||||
`store_id` INT(11) NOT NULL DEFAULT '0',
|
||||
`product_variation_id` varchar(64),
|
||||
`destination_statuses` TEXT NOT NULL,
|
||||
`data_quality_issues` TEXT NOT NULL,
|
||||
`item_level_issues` TEXT NOT NULL,
|
||||
`google_expiration_date` INT(11) NOT NULL DEFAULT '0',
|
||||
PRIMARY KEY (`product_id`, `store_id`, `product_variation_id`)
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=utf8");
|
||||
|
||||
$this->db->query("CREATE TABLE IF NOT EXISTS `" . DB_PREFIX . "googleshopping_product_target` (
|
||||
`product_id` INT(11) NOT NULL,
|
||||
`store_id` INT(11) NOT NULL DEFAULT '0',
|
||||
`advertise_google_target_id` INT(11) UNSIGNED NOT NULL,
|
||||
PRIMARY KEY (`product_id`, `advertise_google_target_id`)
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=utf8");
|
||||
|
||||
$this->db->query("CREATE TABLE IF NOT EXISTS `" . DB_PREFIX . "googleshopping_category` (
|
||||
`google_product_category` VARCHAR(10) NOT NULL,
|
||||
`store_id` INT(11) NOT NULL DEFAULT '0',
|
||||
`category_id` INT(11) NOT NULL,
|
||||
INDEX `category_id_store_id` (`category_id`, `store_id`),
|
||||
PRIMARY KEY (`google_product_category`, `store_id`)
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=utf8");
|
||||
|
||||
$this->db->query("CREATE TABLE IF NOT EXISTS `" . DB_PREFIX . "googleshopping_target` (
|
||||
`advertise_google_target_id` INT(11) UNSIGNED NOT NULL AUTO_INCREMENT,
|
||||
`store_id` INT(11) NOT NULL DEFAULT '0',
|
||||
`campaign_name` varchar(255) NOT NULL DEFAULT '',
|
||||
`country` varchar(2) NOT NULL DEFAULT '',
|
||||
`budget` decimal(15,4) NOT NULL DEFAULT '0.0000',
|
||||
`feeds` text NOT NULL,
|
||||
`date_added` DATE,
|
||||
`roas` INT(11) NOT NULL DEFAULT '0',
|
||||
`status` ENUM('paused','active') NOT NULL DEFAULT 'paused',
|
||||
INDEX `store_id` (`store_id`),
|
||||
PRIMARY KEY (`advertise_google_target_id`)
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=utf8");
|
||||
}
|
||||
|
||||
public function fixColumns() {
|
||||
$has_auto_increment = $this->db->query("SHOW COLUMNS FROM `" . DB_PREFIX . "googleshopping_product` WHERE Field='product_advertise_google_id' AND Extra LIKE '%auto_increment%'")->num_rows > 0;
|
||||
|
||||
if (!$has_auto_increment) {
|
||||
$this->db->query("ALTER TABLE " . DB_PREFIX . "googleshopping_product MODIFY COLUMN product_advertise_google_id INT(11) UNSIGNED NOT NULL AUTO_INCREMENT");
|
||||
}
|
||||
|
||||
$has_unique_key = $this->db->query("SHOW INDEX FROM `" . DB_PREFIX . "googleshopping_product` WHERE Key_name='product_id_store_id' AND Non_unique=0")->num_rows == 2;
|
||||
|
||||
if (!$has_unique_key) {
|
||||
$index_exists = $this->db->query("SHOW INDEX FROM `" . DB_PREFIX . "googleshopping_product` WHERE Key_name='product_id_store_id'")->num_rows > 0;
|
||||
|
||||
if ($index_exists) {
|
||||
$this->db->query("ALTER TABLE `" . DB_PREFIX . "googleshopping_product` DROP INDEX product_id_store_id;");
|
||||
}
|
||||
|
||||
$this->db->query("CREATE UNIQUE INDEX product_id_store_id ON `" . DB_PREFIX . "googleshopping_product` (product_id, store_id)");
|
||||
}
|
||||
|
||||
$has_date_added_column = $this->db->query("SHOW COLUMNS FROM `" . DB_PREFIX . "googleshopping_target` WHERE Field='date_added'")->num_rows > 0;
|
||||
|
||||
if (!$has_date_added_column) {
|
||||
$this->db->query("ALTER TABLE " . DB_PREFIX . "googleshopping_target ADD COLUMN date_added DATE");
|
||||
|
||||
$this->db->query("UPDATE " . DB_PREFIX . "googleshopping_target SET date_added = NOW() WHERE date_added IS NULL");
|
||||
}
|
||||
|
||||
$has_roas_column = $this->db->query("SHOW COLUMNS FROM `" . DB_PREFIX . "googleshopping_target` WHERE Field='roas'")->num_rows > 0;
|
||||
|
||||
if (!$has_roas_column) {
|
||||
$this->db->query("ALTER TABLE " . DB_PREFIX . "googleshopping_target ADD COLUMN roas INT(11) NOT NULL DEFAULT '0'");
|
||||
}
|
||||
}
|
||||
|
||||
public function dropTables() {
|
||||
$this->db->query("DROP TABLE IF EXISTS `" . DB_PREFIX . "googleshopping_target`");
|
||||
$this->db->query("DROP TABLE IF EXISTS `" . DB_PREFIX . "googleshopping_category`");
|
||||
$this->db->query("DROP TABLE IF EXISTS `" . DB_PREFIX . "googleshopping_product_status`");
|
||||
$this->db->query("DROP TABLE IF EXISTS `" . DB_PREFIX . "googleshopping_product_target`");
|
||||
$this->db->query("DROP TABLE IF EXISTS `" . DB_PREFIX . "googleshopping_product`");
|
||||
}
|
||||
|
||||
public function deleteEvents() {
|
||||
$this->load->model('setting/event');
|
||||
|
||||
$this->model_setting_event->deleteEventByCode('advertise_google');
|
||||
}
|
||||
|
||||
public function createEvents() {
|
||||
$this->load->model('setting/event');
|
||||
|
||||
foreach ($this->events as $trigger => $actions) {
|
||||
foreach ($actions as $action) {
|
||||
$this->model_setting_event->addEvent('advertise_google', $trigger, $action, 1, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function getAllowedTargets() {
|
||||
$this->load->config('googleshopping/googleshopping');
|
||||
|
||||
$result = array();
|
||||
|
||||
foreach ($this->config->get('advertise_google_targets') as $target) {
|
||||
$result[] = array(
|
||||
'country' => array(
|
||||
'code' => $target['country'],
|
||||
'name' => $this->googleshopping->getCountryName($target['country'])
|
||||
),
|
||||
'languages' => $this->googleshopping->getLanguages($target['languages']),
|
||||
'currencies' => $this->googleshopping->getCurrencies($target['currencies'])
|
||||
);
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
protected function country($row) {
|
||||
return $row['country'];
|
||||
}
|
||||
}
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 7.3 KiB |
@@ -1,178 +0,0 @@
|
||||
@charset "UTF-8";
|
||||
:root {
|
||||
--s-width: 900px;
|
||||
--s-gutter: 2.5rem;
|
||||
--c-background: rgb(0, 0, 0);
|
||||
--c-accent: hsl(213, 74%, 58%);
|
||||
}
|
||||
|
||||
.stepper {
|
||||
--s-stepper-bullet: 2rem;
|
||||
--s-stepper-bullet-half: calc( var(--s-stepper-bullet) / 2 );
|
||||
--step-transition: background .5s, color .5s;
|
||||
--step-content: '✔︎';
|
||||
--step-color: hsl(0, 0%, 70%);
|
||||
--step-bar-bg: var(--c-accent);
|
||||
--step-bullet-bg: var(--step-bar-bg);
|
||||
--step-bullet-color: white;
|
||||
counter-reset: current-step;
|
||||
display: grid;
|
||||
grid-template-columns: repeat(auto-fit, minmax(1px, 1fr));
|
||||
position: relative;
|
||||
z-index: 1;
|
||||
margin: 20px 0;
|
||||
}
|
||||
.stepper__input {
|
||||
counter-increment: steps;
|
||||
display: none;
|
||||
}
|
||||
.stepper__step {
|
||||
counter-increment: current-step;
|
||||
}
|
||||
.stepper__input:checked ~ .stepper__step {
|
||||
--step-color: hsl(0, 0%, 30%);
|
||||
--step-bar-bg: hsl(0, 0%, 40%);
|
||||
--step-bullet-bg: var(--step-bar-bg);
|
||||
--step-bullet-color: white; /*hsl(0, 0%, 20%);*/
|
||||
--step-content: counter(current-step);
|
||||
}
|
||||
.stepper__input:checked ~ .stepper__step .stepper__content {
|
||||
opacity: 0;
|
||||
pointer-events: none;
|
||||
-webkit-user-select: none;
|
||||
-moz-user-select: none;
|
||||
-ms-user-select: none;
|
||||
user-select: none;
|
||||
}
|
||||
.stepper__input:checked + .stepper__step {
|
||||
--step-bullet-bg: hsl(213, 70%, 50%);
|
||||
--step-bullet-color: white;
|
||||
--step-color: hsl(0, 0%, 30%);
|
||||
}
|
||||
.stepper__input:checked + .stepper__step .stepper__button::before {
|
||||
box-shadow: 0 0 0 2px var(--c-accent);
|
||||
}
|
||||
.stepper__input:checked + .stepper__step .stepper__content {
|
||||
opacity: 1;
|
||||
pointer-events: auto;
|
||||
-webkit-user-select: auto;
|
||||
-moz-user-select: auto;
|
||||
-ms-user-select: auto;
|
||||
user-select: auto;
|
||||
}
|
||||
.stepper__content {
|
||||
color: white;
|
||||
text-align: center;
|
||||
font-style: italic;
|
||||
font-weight: 300;
|
||||
color: var(--step-color);
|
||||
transition: opacity .5s .05s;
|
||||
padding: .5rem;
|
||||
}
|
||||
.stepper__content::-moz-selection {
|
||||
color: black;
|
||||
background: var(--step-bullet-color);
|
||||
}
|
||||
.stepper__content::selection {
|
||||
color: black;
|
||||
background: var(--step-bullet-color);
|
||||
}
|
||||
.stepper__button {
|
||||
position: relative;
|
||||
text-align: center;
|
||||
color: var(--step-color);
|
||||
display: block;
|
||||
}
|
||||
.stepper__button::before {
|
||||
content: var(--step-content);
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
margin: 0 auto var(--s-stepper-bullet-half);
|
||||
height: var(--s-stepper-bullet);
|
||||
width: var(--s-stepper-bullet);
|
||||
border-radius: var(--s-stepper-bullet);
|
||||
transition: var(--step-transition);
|
||||
background: var(--step-bullet-bg);
|
||||
color: var(--step-bullet-color);
|
||||
}
|
||||
.stepper__button::after {
|
||||
content: '';
|
||||
position: absolute;
|
||||
width: 100%;
|
||||
height: calc( var(--s-stepper-bullet-half) / 2 );
|
||||
background: var(--step-bar-bg);
|
||||
transition: var(--step-transition);
|
||||
top: var(--s-stepper-bullet-half);
|
||||
left: 50%;
|
||||
-webkit-transform: translate(0, -50%);
|
||||
transform: translate(0, -50%);
|
||||
z-index: -1;
|
||||
}
|
||||
.stepper__step:last-child .stepper__button::after {
|
||||
display: none;
|
||||
}
|
||||
.stepper--flexbox {
|
||||
display: flex;
|
||||
}
|
||||
.stepper--flexbox .stepper__step {
|
||||
flex-grow: 1;
|
||||
flex-shrink: 0;
|
||||
flex-basis: 0;
|
||||
}
|
||||
|
||||
body {
|
||||
font-family: sans-serif;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
grid-area: content;
|
||||
}
|
||||
|
||||
article {
|
||||
padding: var(--s-gutter) calc(50% - var(--s-width) / 2);
|
||||
background: #121212;
|
||||
color: #cccccc;
|
||||
}
|
||||
article h1 {
|
||||
font-weight: 100;
|
||||
font-size: 2rem;
|
||||
padding: 0 var(--s-gutter);
|
||||
margin: 0;
|
||||
}
|
||||
article ul,
|
||||
article li {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
list-style: none;
|
||||
}
|
||||
article li {
|
||||
padding-left: 1rem;
|
||||
text-indent: -.7rem;
|
||||
padding-top: .5rem;
|
||||
}
|
||||
article li::before {
|
||||
content: "• ";
|
||||
color: var(--c-accent);
|
||||
}
|
||||
article ul,
|
||||
article p {
|
||||
padding: calc( var(--s-gutter) / 2 ) var(--s-gutter) 0;
|
||||
}
|
||||
|
||||
.container, .container__item {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
list-style: none;
|
||||
}
|
||||
.container__item {
|
||||
padding: var(--s-gutter) calc(50% - var(--s-width) / 2);
|
||||
border-bottom: 2px solid rgba(255, 255, 255, 0.15);
|
||||
}
|
||||
.container__item h2 {
|
||||
padding: calc(var(--s-gutter) / 2) var(--s-gutter) var(--s-gutter);
|
||||
margin: 0;
|
||||
text-transform: uppercase;
|
||||
font-weight: 100;
|
||||
color: #8a97a8;
|
||||
font-size: 1.4rem;
|
||||
}
|
||||
@@ -1,88 +0,0 @@
|
||||
{{ header }}
|
||||
{{ column_left }}
|
||||
<div id="content">
|
||||
<div class="page-header">
|
||||
<div class="container-fluid">
|
||||
<div class="pull-right">
|
||||
<button type="submit" class="btn btn-primary" form="form" data-toggle="tooltip" title="{{ button_save }}"><i class="fa fa-save"></i></button>
|
||||
<a href="{{ mapping }}" class="btn btn-warning" data-toggle="tooltip" title="{{ button_mapping }}"><i class="fa fa-tags"></i></a>
|
||||
<a href="{{ shipping_taxes }}" class="btn btn-warning" data-toggle="tooltip" title="{{ button_shipping_taxes }}"><i class="fa fa-truck"></i></a>
|
||||
<a href="{{ campaign }}" class="btn btn-warning" data-toggle="tooltip" title="{{ button_campaign }}"><i class="fa fa-cogs"></i></a>
|
||||
<a href="{{ text_video_tutorial_url_setup }}" target="_blank" class="btn btn-info" data-toggle="tooltip" title="{{ button_video_tutorial_setup }}"><i class="fa fa-video-camera"></i></a>
|
||||
<a href="{{ cancel }}" class="btn btn-default" data-toggle="tooltip" title="{{ button_cancel }}"><i class="fa fa-reply"></i></a>
|
||||
</div>
|
||||
<h1>{{ heading_title }}</h1>
|
||||
<ul class="breadcrumb">
|
||||
{% for breadcrumb in breadcrumbs %}
|
||||
<li><a href="{{ breadcrumb.href }}">{{ breadcrumb.text }}</a></li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
<div class="container-fluid">
|
||||
{% if success %}
|
||||
<div class="alert alert-success alert-dismissible" role="alert">
|
||||
<button type="button" class="close" data-dismiss="alert" aria-label="{{ text_close }}"><i class="fa fa-close"></i></button>
|
||||
<i class="fa fa-check-circle"></i> {{ success }}
|
||||
</div>
|
||||
{% endif %}
|
||||
<div id="blockerError" style="display: none;" class="alert alert-danger">
|
||||
<i class="fa fa-exclamation-triangle"></i> {{ error_adblock }}
|
||||
</div>
|
||||
{% if error %}
|
||||
<div class="alert alert-danger alert-dismissible" role="alert">
|
||||
<button type="button" class="close" data-dismiss="alert" aria-label="{{ text_close }}"><i class="fa fa-close"></i></button>
|
||||
<i class="fa fa-exclamation-triangle"></i> {{ error }}
|
||||
</div>
|
||||
{% endif %}
|
||||
<div id="warning-container">
|
||||
{% if warning %}
|
||||
<div class="alert alert-warning alert-dismissible" role="alert">
|
||||
<button type="button" class="close" data-dismiss="alert" aria-label="{{ text_close }}"><i class="fa fa-close"></i></button>
|
||||
<i class="fa fa-info-circle"></i> {{ warning }}
|
||||
</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
<div id="alert-container"></div>
|
||||
<div class="panel panel-default">
|
||||
<div class="panel-heading">
|
||||
<h3 class="panel-title"><i class="fa fa-pencil"></i> <span>{{ text_panel_heading }}</span></h3>
|
||||
</div>
|
||||
<div class="panel-body">
|
||||
<form action="{{ action }}" method="post" enctype="multipart/form-data" id="form">
|
||||
<div class="tabbable">
|
||||
<ul class="nav nav-tabs mainMenuTabs">
|
||||
<li class="active"><a href="#tab_ads" data-toggle="tab">{{ tab_text_ads }}</a></li>
|
||||
<li><a href="#tab_reports" data-toggle="tab">{{ tab_text_reports }}</a></li>
|
||||
<li><a href="#tab_settings" data-toggle="tab">{{ tab_text_settings }}</a></li>
|
||||
</ul>
|
||||
<div class="tab-content">
|
||||
<div class="tab-pane" id="tab_settings">{{ tab_settings }}</div>
|
||||
<div class="tab-pane active" id="tab_ads">{{ tab_ads }}</div>
|
||||
<div class="tab-pane" id="tab_reports">{{ tab_reports }}</div>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<style type="text/css">
|
||||
.adBanner {
|
||||
background-color: transparent;
|
||||
height: 1px;
|
||||
width: 1px;
|
||||
}
|
||||
</style>
|
||||
<div id="wrapTest">
|
||||
<div class="adBanner">
|
||||
</div>
|
||||
</div>
|
||||
<script type="text/javascript">
|
||||
(function($) {
|
||||
$(document).ready(function() {
|
||||
$('#blockerError').toggle($("#wrapTest").height() == 0);
|
||||
});
|
||||
})(jQuery);
|
||||
</script>
|
||||
{{ footer }}
|
||||
@@ -1,59 +0,0 @@
|
||||
{{ header }}{{ column_left }}
|
||||
<div id="content">
|
||||
<div class="page-header">
|
||||
<div class="container-fluid">
|
||||
<div class="pull-right">
|
||||
<button type="submit" form="form-analytics" data-toggle="tooltip" title="{{ button_save }}" class="btn btn-primary"><i class="fa fa-save"></i></button>
|
||||
<a href="{{ cancel }}" data-toggle="tooltip" title="{{ button_cancel }}" class="btn btn-default"><i class="fa fa-reply"></i></a></div>
|
||||
<h1>{{ heading_title }}</h1>
|
||||
<ul class="breadcrumb">
|
||||
{% for breadcrumb in breadcrumbs %}
|
||||
<li><a href="{{ breadcrumb.href }}">{{ breadcrumb.text }}</a></li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
<div class="container-fluid">
|
||||
{% if error_warning %}
|
||||
<div class="alert alert-danger alert-dismissible"><i class="fa fa-exclamation-circle"></i> {{ error_warning }}
|
||||
<button type="button" class="close" data-dismiss="alert">×</button>
|
||||
</div>
|
||||
{% endif %}
|
||||
<div class="panel panel-default">
|
||||
<div class="panel-heading">
|
||||
<h3 class="panel-title"><i class="fa fa-pencil"></i> {{ text_edit }}</h3>
|
||||
</div>
|
||||
<div class="panel-body">
|
||||
<form action="{{ action }}" method="post" enctype="multipart/form-data" id="form-analytics" class="form-horizontal">
|
||||
<div class="alert alert-info"><i class="fa fa-info-circle"></i> {{ text_signup }}
|
||||
<button type="button" class="close" data-dismiss="alert">×</button>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-2 control-label" for="input-code">{{ entry_code }}</label>
|
||||
<div class="col-sm-10">
|
||||
<textarea name="analytics_google_code" rows="5" placeholder="{{ entry_code }}" id="input-code" class="form-control">{{ analytics_google_code }}</textarea>
|
||||
{% if error_code %}
|
||||
<div class="text-danger">{{ error_code }}</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-2 control-label" for="input-status">{{ entry_status }}</label>
|
||||
<div class="col-sm-10">
|
||||
<select name="analytics_google_status" id="input-status" class="form-control">
|
||||
{% if analytics_google_status %}
|
||||
<option value="1" selected="selected">{{ text_enabled }}</option>
|
||||
<option value="0">{{ text_disabled }}</option>
|
||||
{% else %}
|
||||
<option value="1">{{ text_enabled }}</option>
|
||||
<option value="0" selected="selected">{{ text_disabled }}</option>
|
||||
{% endif %}
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{{ footer }}
|
||||
@@ -1,66 +0,0 @@
|
||||
{{ header }}{{ column_left }}
|
||||
<div id="content">
|
||||
<div class="page-header">
|
||||
<div class="container-fluid">
|
||||
<div class="pull-right">
|
||||
<button type="submit" form="form-captcha" data-toggle="tooltip" title="{{ button_save }}" class="btn btn-primary"><i class="fa fa-save"></i></button>
|
||||
<a href="{{ cancel }}" data-toggle="tooltip" title="{{ button_cancel }}" class="btn btn-default"><i class="fa fa-reply"></i></a></div>
|
||||
<h1>{{ heading_title }}</h1>
|
||||
<ul class="breadcrumb">
|
||||
{% for breadcrumb in breadcrumbs %}
|
||||
<li><a href="{{ breadcrumb.href }}">{{ breadcrumb.text }}</a></li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
<div class="container-fluid">
|
||||
{% if error_warning %}
|
||||
<div class="alert alert-danger alert-dismissible"><i class="fa fa-exclamation-circle"></i> {{ error_warning }}
|
||||
<button type="button" class="close" data-dismiss="alert">×</button>
|
||||
</div>
|
||||
{% endif %}
|
||||
<div class="panel panel-default">
|
||||
<div class="panel-heading">
|
||||
<h3 class="panel-title"><i class="fa fa-pencil"></i> {{ text_edit }}</h3>
|
||||
</div>
|
||||
<div class="panel-body">
|
||||
<form action="{{ action }}" method="post" enctype="multipart/form-data" id="form-captcha" class="form-horizontal">
|
||||
<div class="alert alert-info"><i class="fa fa-info-circle"></i> {{ text_signup }}</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-2 control-label" for="input-key">{{ entry_key }}</label>
|
||||
<div class="col-sm-10">
|
||||
<input type="text" name="captcha_google_key" value="{{ captcha_google_key }}" placeholder="{{ entry_key }}" id="input-key" class="form-control" />
|
||||
{% if error_key %}
|
||||
<div class="text-danger">{{ error_key }}</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-2 control-label" for="input-secret">{{ entry_secret }}</label>
|
||||
<div class="col-sm-10">
|
||||
<input type="text" name="captcha_google_secret" value="{{ captcha_google_secret }}" placeholder="{{ entry_secret }}" id="input-secret" class="form-control" />
|
||||
{% if error_secret %}
|
||||
<div class="text-danger">{{ error_secret }}</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-2 control-label" for="input-status">{{ entry_status }}</label>
|
||||
<div class="col-sm-10">
|
||||
<select name="captcha_google_status" id="input-status" class="form-control">
|
||||
{% if captcha_google_status %}
|
||||
<option value="1" selected="selected">{{ text_enabled }}</option>
|
||||
<option value="0">{{ text_disabled }}</option>
|
||||
{% else %}
|
||||
<option value="1">{{ text_enabled }}</option>
|
||||
<option value="0" selected="selected">{{ text_disabled }}</option>
|
||||
{% endif %}
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{{ footer }}
|
||||
@@ -1,380 +0,0 @@
|
||||
<?php
|
||||
|
||||
use \googleshopping\traits\StoreLoader;
|
||||
use \googleshopping\traits\LibraryLoader;
|
||||
|
||||
class ControllerExtensionAdvertiseGoogle extends Controller {
|
||||
use StoreLoader;
|
||||
use LibraryLoader;
|
||||
|
||||
private $store_id = 0;
|
||||
|
||||
public function __construct($registry) {
|
||||
parent::__construct($registry);
|
||||
|
||||
if (getenv("ADVERTISE_GOOGLE_STORE_ID")) {
|
||||
$this->store_id = (int)getenv("ADVERTISE_GOOGLE_STORE_ID");
|
||||
} else {
|
||||
$this->store_id = (int)$this->config->get('config_store_id');
|
||||
}
|
||||
|
||||
$this->loadStore($this->store_id);
|
||||
}
|
||||
|
||||
public function google_global_site_tag(&$route, &$data, &$output) {
|
||||
// In case the extension is disabled, do nothing
|
||||
if (!$this->setting->get('advertise_google_status')) {
|
||||
return;
|
||||
}
|
||||
|
||||
// If there is no tracker, do nothing
|
||||
if (!$this->setting->has('advertise_google_conversion_tracker')) {
|
||||
return;
|
||||
}
|
||||
|
||||
$tracker = $this->setting->get('advertise_google_conversion_tracker');
|
||||
|
||||
// Insert the tags before the closing <head> tag
|
||||
$output = str_replace('</head>', $tracker['google_global_site_tag'] . '</head>', $output);
|
||||
}
|
||||
|
||||
public function before_checkout_success(&$route, &$data) {
|
||||
// In case the extension is disabled, do nothing
|
||||
if (!$this->setting->get('advertise_google_status')) {
|
||||
return;
|
||||
}
|
||||
|
||||
// If there is no tracker, do nothing
|
||||
if (!$this->setting->has('advertise_google_conversion_tracker')) {
|
||||
return;
|
||||
}
|
||||
|
||||
// In case there is no order, do nothing
|
||||
if (!isset($this->session->data['order_id'])) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!$this->registry->has('googleshopping')) {
|
||||
$this->loadLibrary($this->store_id);
|
||||
}
|
||||
|
||||
$this->load->model('checkout/order');
|
||||
$this->load->model('extension/advertise/google');
|
||||
|
||||
$order_info = $this->model_checkout_order->getOrder($this->session->data['order_id']);
|
||||
|
||||
$tracker = $this->setting->get('advertise_google_conversion_tracker');
|
||||
$currency = $order_info['currency_code'];
|
||||
|
||||
$total = $this->googleshopping->convertAndFormat($order_info['total'], $currency);
|
||||
|
||||
$search = array(
|
||||
'{VALUE}',
|
||||
'{CURRENCY}'
|
||||
);
|
||||
|
||||
$replace = array(
|
||||
$total,
|
||||
$currency
|
||||
);
|
||||
|
||||
$snippet = str_replace($search, $replace, $tracker['google_event_snippet']);
|
||||
|
||||
// Store the snippet to display it in the order success view
|
||||
$tax = 0;
|
||||
$shipping = 0;
|
||||
$coupon = $this->model_extension_advertise_google->getCoupon($order_info['order_id']);
|
||||
|
||||
foreach ($this->model_checkout_order->getOrderTotals($order_info['order_id']) as $order_total) {
|
||||
if ($order_total['code'] == 'shipping') {
|
||||
$shipping += $this->googleshopping->convertAndFormat($order_total['value'], $currency);
|
||||
}
|
||||
|
||||
if ($order_total['code'] == 'tax') {
|
||||
$tax += $this->googleshopping->convertAndFormat($order_total['value'], $currency);
|
||||
}
|
||||
}
|
||||
|
||||
$order_products = $this->model_checkout_order->getOrderProducts($order_info['order_id']);
|
||||
|
||||
foreach ($order_products as &$order_product) {
|
||||
$order_product['option'] = $this->model_checkout_order->getOrderOptions($order_info['order_id'], $order_product['order_product_id']);
|
||||
}
|
||||
|
||||
$purchase_data = array(
|
||||
'transaction_id' => $order_info['order_id'],
|
||||
'value' => $total,
|
||||
'currency' => $currency,
|
||||
'tax' => $tax,
|
||||
'shipping' => $shipping,
|
||||
'items' => $this->model_extension_advertise_google->getRemarketingItems($order_products, $order_info['store_id']),
|
||||
'ecomm_prodid' => $this->model_extension_advertise_google->getRemarketingProductIds($order_products, $order_info['store_id'])
|
||||
);
|
||||
|
||||
if ($coupon !== null) {
|
||||
$purchase_data['coupon'] = $coupon;
|
||||
}
|
||||
|
||||
$this->googleshopping->setEventSnippet($snippet);
|
||||
$this->googleshopping->setPurchaseData($purchase_data);
|
||||
}
|
||||
|
||||
public function google_dynamic_remarketing_purchase(&$route, &$data, &$output) {
|
||||
// In case the extension is disabled, do nothing
|
||||
if (!$this->setting->get('advertise_google_status')) {
|
||||
return;
|
||||
}
|
||||
|
||||
// If the library has not been loaded, or if there is no snippet, do nothing
|
||||
if (!$this->registry->has('googleshopping') || $this->googleshopping->getEventSnippet() === null || $this->googleshopping->getPurchaseData() === null) {
|
||||
return;
|
||||
}
|
||||
|
||||
$data['send_to'] = $this->googleshopping->getEventSnippetSendTo();
|
||||
|
||||
$purchase_data = $this->googleshopping->getPurchaseData();
|
||||
|
||||
$data['transaction_id'] = $purchase_data['transaction_id'];
|
||||
$data['value'] = $purchase_data['value'];
|
||||
$data['currency'] = $purchase_data['currency'];
|
||||
$data['tax'] = $purchase_data['tax'];
|
||||
$data['shipping'] = $purchase_data['shipping'];
|
||||
$data['items'] = json_encode($purchase_data['items']);
|
||||
$data['ecomm_prodid'] = json_encode($purchase_data['ecomm_prodid']);
|
||||
$data['ecomm_totalvalue'] = $purchase_data['value'];
|
||||
|
||||
$purchase_snippet = $this->load->view('extension/advertise/google_dynamic_remarketing_purchase', $data);
|
||||
|
||||
// Insert the snippet after the output
|
||||
$output = str_replace('</body>', $this->googleshopping->getEventSnippet() . $purchase_snippet . '</body>', $output);
|
||||
}
|
||||
|
||||
public function google_dynamic_remarketing_home(&$route, &$data, &$output) {
|
||||
// In case the extension is disabled, do nothing
|
||||
if (!$this->setting->get('advertise_google_status')) {
|
||||
return;
|
||||
}
|
||||
|
||||
// If we are not on the home page, do nothing
|
||||
if (isset($this->request->get['route']) && $this->request->get['route'] != $this->config->get('action_default')) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!$this->registry->has('googleshopping')) {
|
||||
$this->loadLibrary($this->store_id);
|
||||
}
|
||||
|
||||
if (null === $this->googleshopping->getEventSnippetSendTo()) {
|
||||
return;
|
||||
}
|
||||
|
||||
$data = array();
|
||||
$data['send_to'] = $this->googleshopping->getEventSnippetSendTo();
|
||||
|
||||
$snippet = $this->load->view('extension/advertise/google_dynamic_remarketing_home', $data);
|
||||
|
||||
// Insert the snippet after the output
|
||||
$output = str_replace('</body>', $snippet . '</body>', $output);
|
||||
}
|
||||
|
||||
public function google_dynamic_remarketing_searchresults(&$route, &$data, &$output) {
|
||||
// In case the extension is disabled, do nothing
|
||||
if (!$this->setting->get('advertise_google_status')) {
|
||||
return;
|
||||
}
|
||||
|
||||
// If we are not on the search page, do nothing
|
||||
if (!isset($this->request->get['route']) || $this->request->get['route'] != 'product/search' || !isset($this->request->get['search'])) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!$this->registry->has('googleshopping')) {
|
||||
$this->loadLibrary($this->store_id);
|
||||
}
|
||||
|
||||
if (null === $this->googleshopping->getEventSnippetSendTo()) {
|
||||
return;
|
||||
}
|
||||
|
||||
$data = array();
|
||||
$data['send_to'] = $this->googleshopping->getEventSnippetSendTo();
|
||||
$data['search_term'] = $this->request->get['search'];
|
||||
|
||||
$snippet = $this->load->view('extension/advertise/google_dynamic_remarketing_searchresults', $data);
|
||||
|
||||
// Insert the snippet after the output
|
||||
$output = str_replace('</body>', $snippet . '</body>', $output);
|
||||
}
|
||||
|
||||
public function google_dynamic_remarketing_category(&$route, &$data, &$output) {
|
||||
// In case the extension is disabled, do nothing
|
||||
if (!$this->setting->get('advertise_google_status')) {
|
||||
return;
|
||||
}
|
||||
|
||||
// If we are not on the search page, do nothing
|
||||
if (!isset($this->request->get['route']) || $this->request->get['route'] != 'product/category') {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!$this->registry->has('googleshopping')) {
|
||||
$this->loadLibrary($this->store_id);
|
||||
}
|
||||
|
||||
if (null === $this->googleshopping->getEventSnippetSendTo()) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (isset($this->request->get['path'])) {
|
||||
$parts = explode('_', $this->request->get['path']);
|
||||
$category_id = (int)end($parts);
|
||||
} else if (isset($this->request->get['category_id'])) {
|
||||
$category_id = (int)$this->request->get['category_id'];
|
||||
} else {
|
||||
$category_id = 0;
|
||||
}
|
||||
|
||||
$this->load->model('extension/advertise/google');
|
||||
|
||||
$data = array();
|
||||
$data['send_to'] = $this->googleshopping->getEventSnippetSendTo();
|
||||
$data['description'] = str_replace('"', '\\"', $this->model_extension_advertise_google->getHumanReadableOpenCartCategory($category_id));
|
||||
|
||||
$snippet = $this->load->view('extension/advertise/google_dynamic_remarketing_category', $data);
|
||||
|
||||
// Insert the snippet after the output
|
||||
$output = str_replace('</body>', $snippet . '</body>', $output);
|
||||
}
|
||||
|
||||
public function google_dynamic_remarketing_product(&$route, &$data, &$output) {
|
||||
// In case the extension is disabled, do nothing
|
||||
if (!$this->setting->get('advertise_google_status')) {
|
||||
return;
|
||||
}
|
||||
|
||||
// If we do not know the viewed product, do nothing
|
||||
if (!isset($this->request->get['product_id']) || !isset($this->request->get['route']) || $this->request->get['route'] != 'product/product') {
|
||||
return;
|
||||
}
|
||||
|
||||
$this->load->model('catalog/product');
|
||||
|
||||
$product_info = $this->model_catalog_product->getProduct((int)$this->request->get['product_id']);
|
||||
|
||||
// If product does not exist, do nothing
|
||||
if (!$product_info) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!$this->registry->has('googleshopping')) {
|
||||
$this->loadLibrary($this->store_id);
|
||||
}
|
||||
|
||||
if (null === $this->googleshopping->getEventSnippetSendTo()) {
|
||||
return;
|
||||
}
|
||||
|
||||
$this->load->model('extension/advertise/google');
|
||||
|
||||
$category_name = $this->model_extension_advertise_google->getHumanReadableCategory($product_info['product_id'], $this->store_id);
|
||||
|
||||
$option_map = $this->model_extension_advertise_google->getSizeAndColorOptionMap($product_info['product_id'], $this->store_id);
|
||||
|
||||
$data = array();
|
||||
$data['send_to'] = $this->googleshopping->getEventSnippetSendTo();
|
||||
$data['option_map'] = json_encode($option_map);
|
||||
$data['brand'] = $product_info['manufacturer'];
|
||||
$data['name'] = $product_info['name'];
|
||||
$data['category'] = str_replace('"', '\\"', $category_name);
|
||||
|
||||
$snippet = $this->load->view('extension/advertise/google_dynamic_remarketing_product', $data);
|
||||
|
||||
// Insert the snippet after the output
|
||||
$output = str_replace('</body>', $snippet . '</body>', $output);
|
||||
}
|
||||
|
||||
public function google_dynamic_remarketing_cart(&$route, &$data, &$output) {
|
||||
// In case the extension is disabled, do nothing
|
||||
if (!$this->setting->get('advertise_google_status')) {
|
||||
return;
|
||||
}
|
||||
|
||||
// If we are not on the cart page, do nothing
|
||||
if (!isset($this->request->get['route']) || $this->request->get['route'] != 'checkout/cart') {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!$this->registry->has('googleshopping')) {
|
||||
$this->loadLibrary($this->store_id);
|
||||
}
|
||||
|
||||
if (null === $this->googleshopping->getEventSnippetSendTo()) {
|
||||
return;
|
||||
}
|
||||
|
||||
$this->load->model('catalog/product');
|
||||
$this->load->model('extension/advertise/google');
|
||||
|
||||
$data = array();
|
||||
$data['send_to'] = $this->googleshopping->getEventSnippetSendTo();
|
||||
$data['ecomm_totalvalue'] = $this->cart->getTotal();
|
||||
$data['ecomm_prodid'] = json_encode($this->model_extension_advertise_google->getRemarketingProductIds($this->cart->getProducts(), $this->store_id));
|
||||
$data['items'] = json_encode($this->model_extension_advertise_google->getRemarketingItems($this->cart->getProducts(), $this->store_id));
|
||||
|
||||
$snippet = $this->load->view('extension/advertise/google_dynamic_remarketing_cart', $data);
|
||||
|
||||
// Insert the snippet after the output
|
||||
$output = str_replace('</body>', $snippet . '</body>', $output);
|
||||
}
|
||||
|
||||
public function cron($cron_id = null, $code = null, $cycle = null, $date_added = null, $date_modified = null) {
|
||||
$this->loadLibrary($this->store_id);
|
||||
|
||||
if (!$this->validateCRON()) {
|
||||
// In case this is not a CRON task
|
||||
return;
|
||||
}
|
||||
|
||||
$this->load->language('extension/advertise/google');
|
||||
|
||||
// Reset taxes to use the store address and zone
|
||||
$this->tax->setShippingAddress($this->config->get('config_country_id'), $this->config->get('config_zone_id'));
|
||||
$this->tax->setPaymentAddress($this->config->get('config_country_id'), $this->config->get('config_zone_id'));
|
||||
$this->tax->setStoreAddress($this->config->get('config_country_id'), $this->config->get('config_zone_id'));
|
||||
|
||||
$this->googleshopping->cron();
|
||||
}
|
||||
|
||||
protected function validateCRON() {
|
||||
if (!$this->setting->get('advertise_google_status')) {
|
||||
// In case the extension is disabled, do nothing
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!$this->setting->get('advertise_google_gmc_account_selected')) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!$this->setting->get('advertise_google_gmc_shipping_taxes_configured')) {
|
||||
return false;
|
||||
}
|
||||
|
||||
try {
|
||||
if (count($this->googleshopping->getTargets($this->store_id)) === 0) {
|
||||
return false;
|
||||
}
|
||||
} catch (\RuntimeException $e) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (isset($this->request->get['cron_token']) && $this->request->get['cron_token'] == $this->config->get('advertise_google_cron_token')) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (defined('ADVERTISE_GOOGLE_ROUTE')) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -1,6 +0,0 @@
|
||||
<?php
|
||||
class ControllerExtensionAnalyticsGoogle extends Controller {
|
||||
public function index() {
|
||||
return html_entity_decode($this->config->get('analytics_google_code'), ENT_QUOTES, 'UTF-8');
|
||||
}
|
||||
}
|
||||
@@ -1,38 +0,0 @@
|
||||
<?php
|
||||
class ControllerExtensionCaptchaGoogle extends Controller {
|
||||
public function index($error = array()) {
|
||||
$this->load->language('extension/captcha/google');
|
||||
|
||||
if (isset($error['captcha'])) {
|
||||
$data['error_captcha'] = $error['captcha'];
|
||||
} else {
|
||||
$data['error_captcha'] = '';
|
||||
}
|
||||
|
||||
$data['site_key'] = $this->config->get('captcha_google_key');
|
||||
|
||||
$data['route'] = $this->request->get['route'];
|
||||
|
||||
return $this->load->view('extension/captcha/google', $data);
|
||||
}
|
||||
|
||||
public function validate() {
|
||||
if (empty($this->session->data['gcapcha'])) {
|
||||
$this->load->language('extension/captcha/google');
|
||||
|
||||
if (!isset($this->request->post['g-recaptcha-response'])) {
|
||||
return $this->language->get('error_captcha');
|
||||
}
|
||||
|
||||
$recaptcha = file_get_contents('https://www.google.com/recaptcha/api/siteverify?secret=' . urlencode($this->config->get('captcha_google_secret')) . '&response=' . $this->request->post['g-recaptcha-response'] . '&remoteip=' . $this->request->server['REMOTE_ADDR']);
|
||||
|
||||
$recaptcha = json_decode($recaptcha, true);
|
||||
|
||||
if ($recaptcha['success']) {
|
||||
$this->session->data['gcapcha'] = true;
|
||||
} else {
|
||||
return $this->language->get('error_captcha');
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,12 +0,0 @@
|
||||
<?php
|
||||
// * @source See SOURCE.txt for source and other copyright.
|
||||
// * @license GNU General Public License version 3; see LICENSE.txt
|
||||
|
||||
// Text
|
||||
$_['text_captcha'] = 'Капча';
|
||||
|
||||
// Entry
|
||||
$_['entry_captcha'] = 'Введите код в поле ниже';
|
||||
|
||||
// Error
|
||||
$_['error_captcha'] = 'Неверно введен код с картинки!';
|
||||
@@ -1,141 +0,0 @@
|
||||
<?php
|
||||
|
||||
class ModelExtensionAdvertiseGoogle extends Model {
|
||||
public function getHumanReadableCategory($product_id, $store_id) {
|
||||
$this->load->config('googleshopping/googleshopping');
|
||||
|
||||
$google_category_result = $this->db->query("SELECT google_product_category FROM `" . DB_PREFIX . "googleshopping_product` pag WHERE pag.product_id = " . (int)$product_id . " AND pag.store_id = " . (int)$store_id);
|
||||
|
||||
if ($google_category_result->num_rows > 0) {
|
||||
$google_category_id = $google_category_result->row['google_product_category'];
|
||||
$google_categories = $this->config->get('advertise_google_google_product_categories');
|
||||
|
||||
if (!empty($google_category_id) && isset($google_categories[$google_category_id])) {
|
||||
return $google_categories[$google_category_id];
|
||||
}
|
||||
}
|
||||
|
||||
$oc_category_result = $this->db->query("SELECT c.category_id FROM `" . DB_PREFIX . "product_to_category` p2c LEFT JOIN `" . DB_PREFIX . "category` c ON (c.category_id = p2c.category_id) WHERE p2c.product_id=" . (int)$product_id . " LIMIT 0,1");
|
||||
|
||||
if ($oc_category_result->num_rows > 0) {
|
||||
return $this->getHumanReadableOpenCartCategory((int)$oc_category_result->row['category_id']);
|
||||
}
|
||||
|
||||
return "";
|
||||
}
|
||||
|
||||
public function getHumanReadableOpenCartCategory($category_id) {
|
||||
$sql = "SELECT GROUP_CONCAT(cd.name ORDER BY cp.level SEPARATOR ' > ') AS path FROM " . DB_PREFIX . "category_path cp LEFT JOIN " . DB_PREFIX . "category_description cd ON (cp.path_id = cd.category_id) WHERE cd.language_id=" . (int)$this->config->get('config_language_id') . " AND cp.category_id=" . (int)$category_id;
|
||||
|
||||
$result = $this->db->query($sql);
|
||||
|
||||
if ($result->num_rows > 0) {
|
||||
return $result->row['path'];
|
||||
}
|
||||
|
||||
return "";
|
||||
}
|
||||
|
||||
public function getSizeAndColorOptionMap($product_id, $store_id) {
|
||||
$color_id = $this->getOptionId($product_id, $store_id, 'color');
|
||||
$size_id = $this->getOptionId($product_id, $store_id, 'size');
|
||||
|
||||
$groups = $this->googleshopping->getGroups($product_id, $this->config->get('config_language_id'), $color_id, $size_id);
|
||||
|
||||
$colors = $this->googleshopping->getProductOptionValueNames($product_id, $this->config->get('config_language_id'), $color_id);
|
||||
$sizes = $this->googleshopping->getProductOptionValueNames($product_id, $this->config->get('config_language_id'), $size_id);
|
||||
|
||||
$map = array(
|
||||
'groups' => $groups,
|
||||
'colors' => count($colors) > 1 ? $colors : null,
|
||||
'sizes' => count($sizes) > 1 ? $sizes : null,
|
||||
);
|
||||
|
||||
return $map;
|
||||
}
|
||||
|
||||
public function getCoupon($order_id) {
|
||||
$sql = "SELECT c.code FROM `" . DB_PREFIX . "coupon_history` ch LEFT JOIN `" . DB_PREFIX . "coupon` c ON (c.coupon_id = ch.coupon_id) WHERE ch.order_id=" . (int)$order_id;
|
||||
|
||||
$result = $this->db->query($sql);
|
||||
|
||||
if ($result->num_rows > 0) {
|
||||
return $result->row['code'];
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public function getRemarketingProductIds($products, $store_id) {
|
||||
$ecomm_prodid = array();
|
||||
|
||||
foreach ($products as $product) {
|
||||
if (null !== $id = $this->getRemarketingProductId($product, $store_id)) {
|
||||
$ecomm_prodid[] = $id;
|
||||
}
|
||||
}
|
||||
|
||||
return $ecomm_prodid;
|
||||
}
|
||||
|
||||
public function getRemarketingItems($products, $store_id) {
|
||||
$items = array();
|
||||
|
||||
foreach ($products as $product) {
|
||||
if (null !== $id = $this->getRemarketingProductId($product, $store_id)) {
|
||||
$items[] = array(
|
||||
'google_business_vertical' => 'retail',
|
||||
'id' => (string)$id,
|
||||
'name' => (string)$product['name'],
|
||||
'quantity' => (int)$product['quantity']
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
return $items;
|
||||
}
|
||||
|
||||
protected function getRemarketingProductId($product, $store_id) {
|
||||
$option_map = $this->getSizeAndColorOptionMap($product['product_id'], $store_id);
|
||||
$found_color = "";
|
||||
$found_size = "";
|
||||
|
||||
foreach ($product['option'] as $option) {
|
||||
if (is_array($option_map['colors'])) {
|
||||
foreach ($option_map['colors'] as $product_option_value_id => $color) {
|
||||
if ($option['product_option_value_id'] == $product_option_value_id) {
|
||||
$found_color = $color;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (is_array($option_map['sizes'])) {
|
||||
foreach ($option_map['sizes'] as $product_option_value_id => $size) {
|
||||
if ($option['product_option_value_id'] == $product_option_value_id) {
|
||||
$found_size = $size;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
foreach ($option_map['groups'] as $id => $group) {
|
||||
if ($group['color'] === $found_color && $group['size'] === $found_size) {
|
||||
return $id;
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
protected function getOptionId($product_id, $store_id, $type) {
|
||||
$sql = "SELECT pag." . $type . " FROM `" . DB_PREFIX . "googleshopping_product` pag WHERE product_id=" . (int)$product_id . " AND store_id=" . (int)$store_id;
|
||||
|
||||
$result = $this->db->query($sql);
|
||||
|
||||
if ($result->num_rows > 0) {
|
||||
return (int)$result->row[$type];
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
@@ -1,18 +0,0 @@
|
||||
<script src="//www.google.com/recaptcha/api.js" type="text/javascript"></script>
|
||||
<fieldset>
|
||||
<legend>{{ text_captcha }}</legend>
|
||||
<div class="form-group required">{% if route|slice(0, 9) == 'checkout/' %}
|
||||
<label class="control-label" for="input-payment-captcha">{{ entry_captcha }}</label>
|
||||
<div id="input-payment-captcha" class="g-recaptcha" data-sitekey="{{ site_key }}"></div>
|
||||
{% if error_captcha %}
|
||||
<div class="text-danger">{{ error_captcha }}</div>
|
||||
{% endif %}
|
||||
{% else %}
|
||||
<label class="col-sm-2 control-label">{{ entry_captcha }}</label>
|
||||
<div class="col-sm-10">
|
||||
<div class="g-recaptcha" data-sitekey="{{ site_key }}"></div>
|
||||
{% if error_captcha %}
|
||||
<div class="text-danger">{{ error_captcha }}</div>
|
||||
{% endif %}</div>
|
||||
{% endif %}</div>
|
||||
</fieldset>
|
||||
@@ -1,774 +0,0 @@
|
||||
<?php
|
||||
|
||||
$_['advertise_google_push_limit'] = 1000; // No more than 1000
|
||||
$_['advertise_google_report_limit'] = 1000; // No more than 1000
|
||||
$_['advertise_google_product_status_limit'] = 1000; // No more than 1000
|
||||
|
||||
// An empty array means it is always required.
|
||||
// An array with values means it is required only in these specific cases
|
||||
$_['advertise_google_country_required_fields'] = array(
|
||||
'google_product_category' => array(
|
||||
'countries' => array(),
|
||||
'selected_field' => NULL
|
||||
),
|
||||
'condition' => array(
|
||||
'countries' => array(),
|
||||
'selected_field' => NULL
|
||||
),
|
||||
'adult' => array(
|
||||
'countries' => array(),
|
||||
'selected_field' => NULL
|
||||
),
|
||||
'multipack' => array(
|
||||
'countries' => array('AU', 'BR', 'CZ', 'FR', 'DE', 'IT', 'JP', 'NL', 'ES', 'CH', 'GB', 'US'),
|
||||
'selected_field' => NULL
|
||||
),
|
||||
'is_bundle' => array(
|
||||
'countries' => array('AU', 'BR', 'CZ', 'FR', 'DE', 'IT', 'JP', 'NL', 'ES', 'CH', 'GB', 'US'),
|
||||
'selected_field' => NULL
|
||||
),
|
||||
'age_group' => array(
|
||||
'countries' => array('BR', 'FR', 'DE', 'JP', 'GB', 'US'),
|
||||
'selected_field' => array(
|
||||
'google_product_category' => array('1604', '178', '3032', '201', '187')
|
||||
)
|
||||
),
|
||||
'color' => array(
|
||||
'countries' => array('BR', 'FR', 'DE', 'JP', 'GB', 'US'),
|
||||
'selected_field' => array(
|
||||
'google_product_category' => array('1604', '178', '3032', '201', '187')
|
||||
)
|
||||
),
|
||||
'gender' => array(
|
||||
'countries' => array('BR', 'FR', 'DE', 'JP', 'GB', 'US'),
|
||||
'selected_field' => array(
|
||||
'google_product_category' => array('1604', '178', '3032', '201', '187')
|
||||
)
|
||||
),
|
||||
'size' => array(
|
||||
'countries' => array('BR', 'FR', 'DE', 'JP', 'GB', 'US'),
|
||||
'selected_field' => array(
|
||||
'google_product_category' => array('1604', '187')
|
||||
)
|
||||
),
|
||||
'size_type' => array(
|
||||
'countries' => array('BR', 'FR', 'DE', 'JP', 'GB', 'US'),
|
||||
'selected_field' => array(
|
||||
'google_product_category' => array('1604', '187')
|
||||
)
|
||||
),
|
||||
'size_system' => array(
|
||||
'countries' => array('BR', 'FR', 'DE', 'JP', 'GB', 'US'),
|
||||
'selected_field' => array(
|
||||
'google_product_category' => array('1604', '187')
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
$_['advertise_google_tax_usa_states'] = array(
|
||||
'21132' => 'Alaska',
|
||||
'21133' => 'Alabama',
|
||||
'21135' => 'Arkansas',
|
||||
'21136' => 'Arizona',
|
||||
'21137' => 'California',
|
||||
'21138' => 'Colorado',
|
||||
'21139' => 'Connecticut',
|
||||
'21140' => 'District of Columbia',
|
||||
'21141' => 'Delaware',
|
||||
'21142' => 'Florida',
|
||||
'21143' => 'Georgia',
|
||||
'21144' => 'Hawaii',
|
||||
'21145' => 'Iowa',
|
||||
'21146' => 'Idaho',
|
||||
'21147' => 'Illinois',
|
||||
'21148' => 'Indiana',
|
||||
'21149' => 'Kansas',
|
||||
'21150' => 'Kentucky',
|
||||
'21151' => 'Louisiana',
|
||||
'21152' => 'Massachusetts',
|
||||
'21153' => 'Maryland',
|
||||
'21154' => 'Maine',
|
||||
'21155' => 'Michigan',
|
||||
'21156' => 'Minnesota',
|
||||
'21157' => 'Missouri',
|
||||
'21158' => 'Mississippi',
|
||||
'21159' => 'Montana',
|
||||
'21160' => 'North Carolina',
|
||||
'21161' => 'North Dakota',
|
||||
'21162' => 'Nebraska',
|
||||
'21163' => 'New Hampshire',
|
||||
'21164' => 'New Jersey',
|
||||
'21165' => 'New Mexico',
|
||||
'21166' => 'Nevada',
|
||||
'21167' => 'New York',
|
||||
'21168' => 'Ohio',
|
||||
'21169' => 'Oklahoma',
|
||||
'21170' => 'Oregon',
|
||||
'21171' => 'Pennsylvania',
|
||||
'21172' => 'Rhode Island',
|
||||
'21173' => 'South Carolina',
|
||||
'21174' => 'South Dakota',
|
||||
'21175' => 'Tennessee',
|
||||
'21176' => 'Texas',
|
||||
'21177' => 'Utah',
|
||||
'21178' => 'Virginia',
|
||||
'21179' => 'Vermont',
|
||||
'21180' => 'Washington',
|
||||
'21182' => 'Wisconsin',
|
||||
'21183' => 'West Virginia',
|
||||
'21184' => 'Wyoming'
|
||||
);
|
||||
|
||||
$_['advertise_google_google_product_categories'] = array(
|
||||
'0' => 'Other (Not on the list)',
|
||||
'1604' => 'Apparel & Accessories > Clothing',
|
||||
'178' => 'Apparel & Accessories > Clothing Accessories > Sunglasses',
|
||||
'3032' => 'Apparel & Accessories > Handbags, Wallets & Cases > Handbags',
|
||||
'201' => 'Apparel & Accessories > Jewelry > Watches',
|
||||
'187' => 'Apparel & Accessories > Shoes',
|
||||
'784' => 'Media > Books',
|
||||
'839' => 'Media > DVDs & Videos',
|
||||
'855' => 'Media > Music & Sound Recordings',
|
||||
'1279' => 'Software > Video Game Software'
|
||||
);
|
||||
|
||||
$_['advertise_google_size_systems'] = array('AU','BR','CN','DE','EU','FR','IT','JP','MEX','UK','US');
|
||||
|
||||
$_['advertise_google_reporting_intervals'] = array(
|
||||
'TODAY',
|
||||
'YESTERDAY',
|
||||
'LAST_7_DAYS',
|
||||
'LAST_WEEK',
|
||||
'LAST_WEEK_SUN_SAT',
|
||||
'LAST_BUSINESS_WEEK',
|
||||
'LAST_14_DAYS',
|
||||
'LAST_30_DAYS',
|
||||
'THIS_WEEK_MON_TODAY',
|
||||
'THIS_WEEK_SUN_TODAY',
|
||||
'THIS_MONTH'
|
||||
);
|
||||
|
||||
$_['advertise_google_reporting_intervals_default'] = 'LAST_30_DAYS';
|
||||
|
||||
// https://support.google.com/adwords/answer/2454022?hl=en&co=ADWORDS.IsAWNCustomer%3Dfalse
|
||||
$_['advertise_google_countries'] = array(
|
||||
'AR' => "Argentina",
|
||||
'AU' => "Australia",
|
||||
'AT' => "Austria",
|
||||
'BE' => "Belgium",
|
||||
'BR' => "Brazil",
|
||||
'CA' => "Canada",
|
||||
'CL' => "Chile",
|
||||
'CO' => "Colombia",
|
||||
'CZ' => "Czechia",
|
||||
'DK' => "Denmark",
|
||||
'FR' => "France",
|
||||
'DE' => "Germany",
|
||||
'HK' => "Hong Kong",
|
||||
'IN' => "India",
|
||||
'ID' => "Indonesia",
|
||||
'IE' => "Ireland",
|
||||
'IL' => "Israel",
|
||||
'IT' => "Italy",
|
||||
'JP' => "Japan",
|
||||
'MY' => "Malaysia",
|
||||
'MX' => "Mexico",
|
||||
'NL' => "Netherlands",
|
||||
'NZ' => "New Zealand",
|
||||
'NO' => "Norway",
|
||||
'PH' => "Philippines",
|
||||
'PL' => "Poland",
|
||||
'PT' => "Portugal",
|
||||
'RU' => "Russia",
|
||||
'SA' => "Saudi Arabia",
|
||||
'SG' => "Singapore",
|
||||
'ZA' => "South Africa",
|
||||
'KR' => "South Korea",
|
||||
'ES' => "Spain",
|
||||
'SE' => "Sweden",
|
||||
'CH' => "Switzerland",
|
||||
'TW' => "Taiwan",
|
||||
'TH' => "Thailand",
|
||||
'TR' => "Turkey",
|
||||
'UA' => "Ukraine",
|
||||
'AE' => "United Arab Emirates",
|
||||
'GB' => "United Kingdom",
|
||||
'US' => "United States",
|
||||
'VN' => "Vietnam"
|
||||
);
|
||||
|
||||
// https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes
|
||||
$_['advertise_google_languages'] = array(
|
||||
'ab' => "Abkhazian",
|
||||
'aa' => "Afar",
|
||||
'af' => "Afrikaans",
|
||||
'ak' => "Akan",
|
||||
'sq' => "Albanian",
|
||||
'am' => "Amharic",
|
||||
'ar' => "Arabic",
|
||||
'an' => "Aragonese",
|
||||
'hy' => "Armenian",
|
||||
'as' => "Assamese",
|
||||
'av' => "Avaric",
|
||||
'ae' => "Avestan",
|
||||
'ay' => "Aymara",
|
||||
'az' => "Azerbaijani",
|
||||
'bm' => "Bambara",
|
||||
'ba' => "Bashkir",
|
||||
'eu' => "Basque",
|
||||
'be' => "Belarusian",
|
||||
'bn' => "Bengali",
|
||||
'bh' => "Bihari languages",
|
||||
'bi' => "Bislama",
|
||||
'bs' => "Bosnian",
|
||||
'br' => "Breton",
|
||||
'bg' => "Bulgarian",
|
||||
'my' => "Burmese",
|
||||
'ca' => "Catalan, Valencian",
|
||||
'ch' => "Chamorro",
|
||||
'ce' => "Chechen",
|
||||
'ny' => "Chichewa, Chewa, Nyanja",
|
||||
'zh' => "Chinese",
|
||||
'cv' => "Chuvash",
|
||||
'kw' => "Cornish",
|
||||
'co' => "Corsican",
|
||||
'cr' => "Cree",
|
||||
'hr' => "Croatian",
|
||||
'cs' => "Czech",
|
||||
'da' => "Danish",
|
||||
'dv' => "Divehi, Dhivehi, Maldivian",
|
||||
'nl' => "Dutch, Flemish",
|
||||
'dz' => "Dzongkha",
|
||||
'en' => "English",
|
||||
'eo' => "Esperanto",
|
||||
'et' => "Estonian",
|
||||
'ee' => "Ewe",
|
||||
'fo' => "Faroese",
|
||||
'fj' => "Fijian",
|
||||
'fl' => "Filipino",
|
||||
'fi' => "Finnish",
|
||||
'fr' => "French",
|
||||
'ff' => "Fulah",
|
||||
'gl' => "Galician",
|
||||
'ka' => "Georgian",
|
||||
'de' => "German",
|
||||
'el' => "Greek (modern)",
|
||||
'gn' => "Guaraní",
|
||||
'gu' => "Gujarati",
|
||||
'ht' => "Haitian, Haitian Creole",
|
||||
'ha' => "Hausa",
|
||||
'he' => "Hebrew (modern)",
|
||||
'hz' => "Herero",
|
||||
'hi' => "Hindi",
|
||||
'ho' => "Hiri Motu",
|
||||
'hu' => "Hungarian",
|
||||
'ia' => "Interlingua",
|
||||
'id' => "Indonesian",
|
||||
'ie' => "Interlingue",
|
||||
'ga' => "Irish",
|
||||
'ig' => "Igbo",
|
||||
'ik' => "Inupiaq",
|
||||
'io' => "Ido",
|
||||
'is' => "Icelandic",
|
||||
'it' => "Italian",
|
||||
'iu' => "Inuktitut",
|
||||
'ja' => "Japanese",
|
||||
'jv' => "Javanese",
|
||||
'kl' => "Kalaallisut, Greenlandic",
|
||||
'kn' => "Kannada",
|
||||
'kr' => "Kanuri",
|
||||
'ks' => "Kashmiri",
|
||||
'kk' => "Kazakh",
|
||||
'km' => "Central Khmer",
|
||||
'ki' => "Kikuyu, Gikuyu",
|
||||
'rw' => "Kinyarwanda",
|
||||
'ky' => "Kirghiz, Kyrgyz",
|
||||
'kv' => "Komi",
|
||||
'kg' => "Kongo",
|
||||
'ko' => "Korean",
|
||||
'ku' => "Kurdish",
|
||||
'kj' => "Kuanyama, Kwanyama",
|
||||
'la' => "Latin",
|
||||
'lb' => "Luxembourgish, Letzeburgesch",
|
||||
'lg' => "Ganda",
|
||||
'li' => "Limburgan, Limburger, Limburgish",
|
||||
'ln' => "Lingala",
|
||||
'lo' => "Lao",
|
||||
'lt' => "Lithuanian",
|
||||
'lu' => "Luba-Katanga",
|
||||
'lv' => "Latvian",
|
||||
'gv' => "Manx",
|
||||
'mk' => "Macedonian",
|
||||
'mg' => "Malagasy",
|
||||
'ms' => "Malay",
|
||||
'ml' => "Malayalam",
|
||||
'mt' => "Maltese",
|
||||
'mi' => "Maori",
|
||||
'mr' => "Marathi",
|
||||
'mh' => "Marshallese",
|
||||
'mn' => "Mongolian",
|
||||
'na' => "Nauru",
|
||||
'nv' => "Navajo, Navaho",
|
||||
'nd' => "North Ndebele",
|
||||
'ne' => "Nepali",
|
||||
'ng' => "Ndonga",
|
||||
'nb' => "Norwegian Bokmål",
|
||||
'nn' => "Norwegian Nynorsk",
|
||||
'no' => "Norwegian",
|
||||
'ii' => "Sichuan Yi, Nuosu",
|
||||
'nr' => "South Ndebele",
|
||||
'oc' => "Occitan",
|
||||
'oj' => "Ojibwa",
|
||||
'cu' => "Church Slavic, Church Slavonic, Old Church Slavonic, Old Slavonic, Old Bulgarian",
|
||||
'om' => "Oromo",
|
||||
'or' => "Oriya",
|
||||
'os' => "Ossetian, Ossetic",
|
||||
'pa' => "Panjabi, Punjabi",
|
||||
'pi' => "Pali",
|
||||
'fa' => "Persian",
|
||||
'pl' => "Polish",
|
||||
'ps' => "Pashto, Pushto",
|
||||
'pt' => "Portuguese",
|
||||
'qu' => "Quechua",
|
||||
'rm' => "Romansh",
|
||||
'rn' => "Rundi",
|
||||
'ro' => "Romanian, Moldavian, Moldovan",
|
||||
'ru' => "Russian",
|
||||
'sa' => "Sanskrit",
|
||||
'sc' => "Sardinian",
|
||||
'sd' => "Sindhi",
|
||||
'se' => "Northern Sami",
|
||||
'sm' => "Samoan",
|
||||
'sg' => "Sango",
|
||||
'sr' => "Serbian",
|
||||
'gd' => "Gaelic, Scottish Gaelic",
|
||||
'sn' => "Shona",
|
||||
'si' => "Sinhala, Sinhalese",
|
||||
'sk' => "Slovak",
|
||||
'sl' => "Slovenian",
|
||||
'so' => "Somali",
|
||||
'st' => "Southern Sotho",
|
||||
'es' => "Spanish, Castilian",
|
||||
'su' => "Sundanese",
|
||||
'sw' => "Swahili",
|
||||
'ss' => "Swati",
|
||||
'sv' => "Swedish",
|
||||
'ta' => "Tamil",
|
||||
'te' => "Telugu",
|
||||
'tg' => "Tajik",
|
||||
'th' => "Thai",
|
||||
'ti' => "Tigrinya",
|
||||
'bo' => "Tibetan",
|
||||
'tk' => "Turkmen",
|
||||
'tl' => "Tagalog",
|
||||
'tn' => "Tswana",
|
||||
'to' => "Tongan (Tonga Islands)",
|
||||
'tr' => "Turkish",
|
||||
'ts' => "Tsonga",
|
||||
'tt' => "Tatar",
|
||||
'tw' => "Twi",
|
||||
'ty' => "Tahitian",
|
||||
'ug' => "Uighur, Uyghur",
|
||||
'uk' => "Ukrainian",
|
||||
'ur' => "Urdu",
|
||||
'uz' => "Uzbek",
|
||||
've' => "Venda",
|
||||
'vi' => "Vietnamese",
|
||||
'vo' => "Volapük",
|
||||
'wa' => "Walloon",
|
||||
'cy' => "Welsh",
|
||||
'wo' => "Wolof",
|
||||
'fy' => "Western Frisian",
|
||||
'xh' => "Xhosa",
|
||||
'yi' => "Yiddish",
|
||||
'yo' => "Yoruba",
|
||||
'za' => "Zhuang, Chuang",
|
||||
'zu' => "Zulu"
|
||||
);
|
||||
|
||||
$_['advertise_google_currencies'] = array(
|
||||
"AED" => "United Arab Emirates Dirham",
|
||||
"AFN" => "Afghanistan Afghani",
|
||||
"ALL" => "Albania Lek",
|
||||
"AMD" => "Armenia Dram",
|
||||
"ANG" => "Netherlands Antilles Guilder",
|
||||
"AOA" => "Angola Kwanza",
|
||||
"ARS" => "Argentina Peso",
|
||||
"AUD" => "Australia Dollar",
|
||||
"AWG" => "Aruba Guilder",
|
||||
"AZN" => "Azerbaijan Manat",
|
||||
"BAM" => "Bosnia and Herzegovina Convertible Marka",
|
||||
"BBD" => "Barbados Dollar",
|
||||
"BDT" => "Bangladesh Taka",
|
||||
"BGN" => "Bulgaria Lev",
|
||||
"BHD" => "Bahrain Dinar",
|
||||
"BIF" => "Burundi Franc",
|
||||
"BMD" => "Bermuda Dollar",
|
||||
"BND" => "Brunei Darussalam Dollar",
|
||||
"BOB" => "Bolivia Bolíviano",
|
||||
"BRL" => "Brazil Real",
|
||||
"BSD" => "Bahamas Dollar",
|
||||
"BTN" => "Bhutan Ngultrum",
|
||||
"BWP" => "Botswana Pula",
|
||||
"BYN" => "Belarus Ruble",
|
||||
"BZD" => "Belize Dollar",
|
||||
"CAD" => "Canada Dollar",
|
||||
"CDF" => "Congo/Kinshasa Franc",
|
||||
"CHF" => "Switzerland Franc",
|
||||
"CLP" => "Chile Peso",
|
||||
"CNY" => "China Yuan Renminbi",
|
||||
"COP" => "Colombia Peso",
|
||||
"CRC" => "Costa Rica Colon",
|
||||
"CUC" => "Cuba Convertible Peso",
|
||||
"CUP" => "Cuba Peso",
|
||||
"CVE" => "Cape Verde Escudo",
|
||||
"CZK" => "Czech Republic Koruna",
|
||||
"DJF" => "Djibouti Franc",
|
||||
"DKK" => "Denmark Krone",
|
||||
"DOP" => "Dominican Republic Peso",
|
||||
"DZD" => "Algeria Dinar",
|
||||
"EGP" => "Egypt Pound",
|
||||
"ERN" => "Eritrea Nakfa",
|
||||
"ETB" => "Ethiopia Birr",
|
||||
"EUR" => "Euro Member Countries",
|
||||
"FJD" => "Fiji Dollar",
|
||||
"FKP" => "Falkland Islands (Malvinas) Pound",
|
||||
"GBP" => "United Kingdom Pound",
|
||||
"GEL" => "Georgia Lari",
|
||||
"GGP" => "Guernsey Pound",
|
||||
"GHS" => "Ghana Cedi",
|
||||
"GIP" => "Gibraltar Pound",
|
||||
"GMD" => "Gambia Dalasi",
|
||||
"GNF" => "Guinea Franc",
|
||||
"GTQ" => "Guatemala Quetzal",
|
||||
"GYD" => "Guyana Dollar",
|
||||
"HKD" => "Hong Kong Dollar",
|
||||
"HNL" => "Honduras Lempira",
|
||||
"HRK" => "Croatia Kuna",
|
||||
"HTG" => "Haiti Gourde",
|
||||
"HUF" => "Hungary Forint",
|
||||
"IDR" => "Indonesia Rupiah",
|
||||
"ILS" => "Israel Shekel",
|
||||
"IMP" => "Isle of Man Pound",
|
||||
"INR" => "India Rupee",
|
||||
"IQD" => "Iraq Dinar",
|
||||
"IRR" => "Iran Rial",
|
||||
"ISK" => "Iceland Krona",
|
||||
"JEP" => "Jersey Pound",
|
||||
"JMD" => "Jamaica Dollar",
|
||||
"JOD" => "Jordan Dinar",
|
||||
"JPY" => "Japan Yen",
|
||||
"KES" => "Kenya Shilling",
|
||||
"KGS" => "Kyrgyzstan Som",
|
||||
"KHR" => "Cambodia Riel",
|
||||
"KMF" => "Comorian Franc",
|
||||
"KPW" => "Korea (North) Won",
|
||||
"KRW" => "Korea (South) Won",
|
||||
"KWD" => "Kuwait Dinar",
|
||||
"KYD" => "Cayman Islands Dollar",
|
||||
"KZT" => "Kazakhstan Tenge",
|
||||
"LAK" => "Laos Kip",
|
||||
"LBP" => "Lebanon Pound",
|
||||
"LKR" => "Sri Lanka Rupee",
|
||||
"LRD" => "Liberia Dollar",
|
||||
"LSL" => "Lesotho Loti",
|
||||
"LYD" => "Libya Dinar",
|
||||
"MAD" => "Morocco Dirham",
|
||||
"MDL" => "Moldova Leu",
|
||||
"MGA" => "Madagascar Ariary",
|
||||
"MKD" => "Macedonia Denar",
|
||||
"MMK" => "Myanmar (Burma) Kyat",
|
||||
"MNT" => "Mongolia Tughrik",
|
||||
"MOP" => "Macau Pataca",
|
||||
"MRU" => "Mauritania Ouguiya",
|
||||
"MUR" => "Mauritius Rupee",
|
||||
"MVR" => "Maldives (Maldive Islands) Rufiyaa",
|
||||
"MWK" => "Malawi Kwacha",
|
||||
"MXN" => "Mexico Peso",
|
||||
"MYR" => "Malaysia Ringgit",
|
||||
"MZN" => "Mozambique Metical",
|
||||
"NAD" => "Namibia Dollar",
|
||||
"NGN" => "Nigeria Naira",
|
||||
"NIO" => "Nicaragua Cordoba",
|
||||
"NOK" => "Norway Krone",
|
||||
"NPR" => "Nepal Rupee",
|
||||
"NZD" => "New Zealand Dollar",
|
||||
"OMR" => "Oman Rial",
|
||||
"PAB" => "Panama Balboa",
|
||||
"PEN" => "Peru Sol",
|
||||
"PGK" => "Papua New Guinea Kina",
|
||||
"PHP" => "Philippines Piso",
|
||||
"PKR" => "Pakistan Rupee",
|
||||
"PLN" => "Poland Zloty",
|
||||
"PYG" => "Paraguay Guarani",
|
||||
"QAR" => "Qatar Riyal",
|
||||
"RON" => "Romania Leu",
|
||||
"RSD" => "Serbia Dinar",
|
||||
"RUB" => "Russia Ruble",
|
||||
"RWF" => "Rwanda Franc",
|
||||
"SAR" => "Saudi Arabia Riyal",
|
||||
"SBD" => "Solomon Islands Dollar",
|
||||
"SCR" => "Seychelles Rupee",
|
||||
"SDG" => "Sudan Pound",
|
||||
"SEK" => "Sweden Krona",
|
||||
"SGD" => "Singapore Dollar",
|
||||
"SHP" => "Saint Helena Pound",
|
||||
"SLL" => "Sierra Leone Leone",
|
||||
"SOS" => "Somalia Shilling",
|
||||
"SPL*" => "Seborga Luigino",
|
||||
"SRD" => "Suriname Dollar",
|
||||
"STN" => "São Tomé and Príncipe Dobra",
|
||||
"SVC" => "El Salvador Colon",
|
||||
"SYP" => "Syria Pound",
|
||||
"SZL" => "Swaziland Lilangeni",
|
||||
"THB" => "Thailand Baht",
|
||||
"TJS" => "Tajikistan Somoni",
|
||||
"TMT" => "Turkmenistan Manat",
|
||||
"TND" => "Tunisia Dinar",
|
||||
"TOP" => "Tonga Pa'anga",
|
||||
"TRY" => "Turkey Lira",
|
||||
"TTD" => "Trinidad and Tobago Dollar",
|
||||
"TVD" => "Tuvalu Dollar",
|
||||
"TWD" => "Taiwan New Dollar",
|
||||
"TZS" => "Tanzania Shilling",
|
||||
"UAH" => "Ukraine Hryvnia",
|
||||
"UGX" => "Uganda Shilling",
|
||||
"USD" => "United States Dollar",
|
||||
"UYU" => "Uruguay Peso",
|
||||
"UZS" => "Uzbekistan Som",
|
||||
"VEF" => "Venezuela Bolívar",
|
||||
"VND" => "Viet Nam Dong",
|
||||
"VUV" => "Vanuatu Vatu",
|
||||
"WST" => "Samoa Tala",
|
||||
"XAF" => "Communauté Financière Africaine (BEAC) CFA Franc BEAC",
|
||||
"XCD" => "East Caribbean Dollar",
|
||||
"XDR" => "International Monetary Fund (IMF) Special Drawing Rights",
|
||||
"XOF" => "Communauté Financière Africaine (BCEAO) Franc",
|
||||
"XPF" => "Comptoirs Français du Pacifique (CFP) Franc",
|
||||
"YER" => "Yemen Rial",
|
||||
"ZAR" => "South Africa Rand",
|
||||
"ZMW" => "Zambia Kwacha",
|
||||
"ZWD" => "Zimbabwe Dollar"
|
||||
);
|
||||
|
||||
/*
|
||||
* These entries are defined based on this help article:
|
||||
* https://support.google.com/merchants/answer/160637?hl=en
|
||||
*/
|
||||
$_['advertise_google_targets'] = array(
|
||||
array(
|
||||
'country' => 'AR',
|
||||
'languages' => array('es'),
|
||||
'currencies' => array('ARS')
|
||||
),
|
||||
array(
|
||||
'country' => 'AU',
|
||||
'languages' => array('en', 'zh'),
|
||||
'currencies' => array('AUD')
|
||||
),
|
||||
array(
|
||||
'country' => 'AT',
|
||||
'languages' => array('de', 'en'),
|
||||
'currencies' => array('EUR')
|
||||
),
|
||||
array(
|
||||
'country' => 'BE',
|
||||
'languages' => array('fr', 'nl', 'en'),
|
||||
'currencies' => array('EUR')
|
||||
),
|
||||
array(
|
||||
'country' => 'BR',
|
||||
'languages' => array('pt'),
|
||||
'currencies' => array('BRL')
|
||||
),
|
||||
array(
|
||||
'country' => 'CA',
|
||||
'languages' => array('en', 'fr', 'zh'),
|
||||
'currencies' => array('CAD')
|
||||
),
|
||||
array(
|
||||
'country' => 'CL',
|
||||
'languages' => array('es'),
|
||||
'currencies' => array('CLP')
|
||||
),
|
||||
array(
|
||||
'country' => 'CO',
|
||||
'languages' => array('es'),
|
||||
'currencies' => array('COP')
|
||||
),
|
||||
array(
|
||||
'country' => 'CZ',
|
||||
'languages' => array('cs', 'en'),
|
||||
'currencies' => array('CZK')
|
||||
),
|
||||
array(
|
||||
'country' => 'DK',
|
||||
'languages' => array('da', 'en'),
|
||||
'currencies' => array('DKK')
|
||||
),
|
||||
array(
|
||||
'country' => 'FR',
|
||||
'languages' => array('fr'),
|
||||
'currencies' => array('EUR')
|
||||
),
|
||||
array(
|
||||
'country' => 'DE',
|
||||
'languages' => array('de', 'en'),
|
||||
'currencies' => array('EUR')
|
||||
),
|
||||
array(
|
||||
'country' => 'HK',
|
||||
'languages' => array('zh', 'en'),
|
||||
'currencies' => array('HKD')
|
||||
),
|
||||
array(
|
||||
'country' => 'IN',
|
||||
'languages' => array('en'),
|
||||
'currencies' => array('INR')
|
||||
),
|
||||
array(
|
||||
'country' => 'ID',
|
||||
'languages' => array('id', 'en'),
|
||||
'currencies' => array('IDR')
|
||||
),
|
||||
array(
|
||||
'country' => 'IE',
|
||||
'languages' => array('en'),
|
||||
'currencies' => array('EUR')
|
||||
),
|
||||
array(
|
||||
'country' => 'IL',
|
||||
'languages' => array('he', 'en'),
|
||||
'currencies' => array('ILS')
|
||||
),
|
||||
array(
|
||||
'country' => 'IT',
|
||||
'languages' => array('it'),
|
||||
'currencies' => array('EUR')
|
||||
),
|
||||
array(
|
||||
'country' => 'JP',
|
||||
'languages' => array('ja'),
|
||||
'currencies' => array('JPY')
|
||||
),
|
||||
array(
|
||||
'country' => 'MY',
|
||||
'languages' => array('en', 'zh'),
|
||||
'currencies' => array('MYR')
|
||||
),
|
||||
array(
|
||||
'country' => 'MX',
|
||||
'languages' => array('es', 'en'),
|
||||
'currencies' => array('MXN')
|
||||
),
|
||||
array(
|
||||
'country' => 'NL',
|
||||
'languages' => array('nl', 'en'),
|
||||
'currencies' => array('EUR')
|
||||
),
|
||||
array(
|
||||
'country' => 'NZ',
|
||||
'languages' => array('en'),
|
||||
'currencies' => array('NZD')
|
||||
),
|
||||
array(
|
||||
'country' => 'NO',
|
||||
'languages' => array('no', 'en'),
|
||||
'currencies' => array('NOK')
|
||||
),
|
||||
array(
|
||||
'country' => 'PH',
|
||||
'languages' => array('en'),
|
||||
'currencies' => array('PHP')
|
||||
),
|
||||
array(
|
||||
'country' => 'PL',
|
||||
'languages' => array('pl'),
|
||||
'currencies' => array('PLN')
|
||||
),
|
||||
array(
|
||||
'country' => 'PT',
|
||||
'languages' => array('pt'),
|
||||
'currencies' => array('EUR')
|
||||
),
|
||||
array(
|
||||
'country' => 'RU',
|
||||
'languages' => array('ru'),
|
||||
'currencies' => array('RUB')
|
||||
),
|
||||
array(
|
||||
'country' => 'SA',
|
||||
'languages' => array('ar', 'en'),
|
||||
'currencies' => array('SAR')
|
||||
),
|
||||
array(
|
||||
'country' => 'SG',
|
||||
'languages' => array('en', 'zh'),
|
||||
'currencies' => array('SGD')
|
||||
),
|
||||
array(
|
||||
'country' => 'ZA',
|
||||
'languages' => array('en'),
|
||||
'currencies' => array('ZAR')
|
||||
),
|
||||
array(
|
||||
'country' => 'KR',
|
||||
'languages' => array('ko', 'en'),
|
||||
'currencies' => array('KRW')
|
||||
),
|
||||
array(
|
||||
'country' => 'ES',
|
||||
'languages' => array('es'),
|
||||
'currencies' => array('EUR')
|
||||
),
|
||||
array(
|
||||
'country' => 'SE',
|
||||
'languages' => array('sv', 'en'),
|
||||
'currencies' => array('SEK')
|
||||
),
|
||||
array(
|
||||
'country' => 'CH',
|
||||
'languages' => array('en', 'de', 'fr', 'it'),
|
||||
'currencies' => array('CHF')
|
||||
),
|
||||
array(
|
||||
'country' => 'TW',
|
||||
'languages' => array('zh', 'en'),
|
||||
'currencies' => array('TWD')
|
||||
),
|
||||
array(
|
||||
'country' => 'TH',
|
||||
'languages' => array('th', 'en'),
|
||||
'currencies' => array('THB')
|
||||
),
|
||||
array(
|
||||
'country' => 'TR',
|
||||
'languages' => array('tr', 'en'),
|
||||
'currencies' => array('TRY')
|
||||
),
|
||||
array(
|
||||
'country' => 'UA',
|
||||
'languages' => array('uk', 'ru'),
|
||||
'currencies' => array('UAH')
|
||||
),
|
||||
array(
|
||||
'country' => 'AE',
|
||||
'languages' => array('en'),
|
||||
'currencies' => array('AED')
|
||||
),
|
||||
array(
|
||||
'country' => 'GB',
|
||||
'languages' => array('en'),
|
||||
'currencies' => array('GBP')
|
||||
),
|
||||
array(
|
||||
'country' => 'US',
|
||||
'languages' => array('en', 'es', 'zh'),
|
||||
'currencies' => array('USD')
|
||||
),
|
||||
array(
|
||||
'country' => 'VN',
|
||||
'languages' => array('vi', 'en'),
|
||||
'currencies' => array('VND')
|
||||
)
|
||||
);
|
||||
@@ -1,9 +0,0 @@
|
||||
<?php
|
||||
|
||||
$current_dir = dirname(__FILE__);
|
||||
|
||||
require_once $current_dir . DIRECTORY_SEPARATOR . 'cron_functions.php';
|
||||
|
||||
if ($index = advertise_google_init($current_dir)) {
|
||||
require_once $index;
|
||||
}
|
||||
@@ -1,42 +0,0 @@
|
||||
<?php
|
||||
|
||||
function advertise_google_validate() {
|
||||
if (!getenv("ADVERTISE_GOOGLE_CRON")) {
|
||||
die("Not in Command Line." . PHP_EOL);
|
||||
}
|
||||
}
|
||||
|
||||
function advertise_google_chdir($current_dir) {
|
||||
$root_dir = dirname(dirname(dirname($current_dir)));
|
||||
|
||||
chdir($root_dir);
|
||||
|
||||
return $root_dir;
|
||||
}
|
||||
|
||||
function advertise_google_define_route() {
|
||||
define('ADVERTISE_GOOGLE_ROUTE', 'extension/advertise/google/cron');
|
||||
|
||||
$_GET['route'] = ADVERTISE_GOOGLE_ROUTE;
|
||||
}
|
||||
|
||||
function advertise_google_init($current_dir) {
|
||||
// Validate environment
|
||||
advertise_google_validate();
|
||||
|
||||
// Set up default server vars
|
||||
$_SERVER["HTTP_HOST"] = getenv("CUSTOM_SERVER_NAME");
|
||||
$_SERVER["SERVER_NAME"] = getenv("CUSTOM_SERVER_NAME");
|
||||
$_SERVER["SERVER_PORT"] = getenv("CUSTOM_SERVER_PORT");
|
||||
|
||||
putenv("SERVER_NAME=" . $_SERVER["SERVER_NAME"]);
|
||||
|
||||
// Change root dir
|
||||
$root_dir = advertise_google_chdir($current_dir);
|
||||
|
||||
advertise_google_define_route();
|
||||
|
||||
if (file_exists($root_dir . '/index.php')) {
|
||||
return $root_dir . '/index.php';
|
||||
}
|
||||
}
|
||||
@@ -1,6 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace googleshopping\Exception;
|
||||
|
||||
class AccessForbidden extends \RuntimeException {
|
||||
}
|
||||
@@ -1,6 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace googleshopping\Exception;
|
||||
|
||||
class Connection extends \RuntimeException {
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,19 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace googleshopping;
|
||||
|
||||
abstract class Library {
|
||||
protected $registry;
|
||||
|
||||
public function __construct($registry) {
|
||||
$this->registry = $registry;
|
||||
}
|
||||
|
||||
public function __get($key) {
|
||||
return $this->registry->get($key);
|
||||
}
|
||||
|
||||
public function __set($key, $value) {
|
||||
$this->registry->set($key, $value);
|
||||
}
|
||||
}
|
||||
@@ -1,55 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace googleshopping;
|
||||
|
||||
/**
|
||||
* Log class
|
||||
*/
|
||||
class Log {
|
||||
private $handle;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param string $filename
|
||||
*/
|
||||
public function __construct($filename, $max_size = 8388608) {
|
||||
$file = DIR_LOGS . $filename;
|
||||
|
||||
clearstatcache(true);
|
||||
|
||||
if ((!file_exists($file) && !is_writable(DIR_LOGS)) || (file_exists($file) && !is_writable($file))) {
|
||||
// Do nothing, as we have no permissions
|
||||
return;
|
||||
}
|
||||
|
||||
if (file_exists($file) && filesize($file) >= $max_size) {
|
||||
$mode = 'wb';
|
||||
} else {
|
||||
$mode = 'ab';
|
||||
}
|
||||
|
||||
$this->handle = @fopen(DIR_LOGS . $filename, $mode);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @param string $message
|
||||
*/
|
||||
public function write($message) {
|
||||
if (is_resource($this->handle)) {
|
||||
fwrite($this->handle, date('Y-m-d G:i:s') . ' - ' . print_r($message, true) . "\n");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
*/
|
||||
public function __destruct() {
|
||||
if (is_resource($this->handle)) {
|
||||
fclose($this->handle);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace googleshopping\traits;
|
||||
|
||||
use \googleshopping\Googleshopping;
|
||||
|
||||
trait LibraryLoader {
|
||||
protected function loadLibrary($store_id) {
|
||||
$this->registry->set('googleshopping', new Googleshopping($this->registry, $store_id));
|
||||
}
|
||||
}
|
||||
@@ -1,15 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace googleshopping\traits;
|
||||
|
||||
trait StoreLoader {
|
||||
protected function loadStore($store_id) {
|
||||
$this->registry->set('setting', new \Config());
|
||||
|
||||
$this->load->model('setting/setting');
|
||||
|
||||
foreach ($this->model_setting_setting->getSetting('advertise_google', $store_id) as $key => $value) {
|
||||
$this->setting->set($key, $value);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user