| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159 |
- <?xml version="1.0" encoding="utf-8"?>
- <modification>
- <name>Reverb Integration</name>
- <code>reverb</code>
- <version>1.0.2</version>
- <author>Reverb OpenCart</author>
- <link>https://reverb.com/au/page/integrations</link>
- <!--
- ========================================================================
- FILE 1: admin/controller/catalog/product.php
- Inject Reverb data loading before the view is rendered,
- and Reverb data saving after addProduct / editProduct calls.
- ========================================================================
- -->
- <file path="admin/controller/catalog/product.php">
- <operation>
- <search><![CDATA[$this->response->setOutput($this->load->view('catalog/product', $data));]]></search>
- <add position="before"><![CDATA[
- $this->load->model('extension/module/reverb');
- $reverb_product_id = isset($this->request->get['product_id']) ? (int)$this->request->get['product_id'] : 0;
- $reverb_row = $this->model_extension_module_reverb->getProductMap($reverb_product_id);
- $data['reverb_sync_enabled'] = $reverb_row ? (int)$reverb_row['sync_enabled'] : 0;
- $data['reverb_condition_uuid'] = $reverb_row ? $reverb_row['condition_uuid'] : '';
- $data['reverb_category_uuid'] = $reverb_row ? $reverb_row['reverb_category_uuid'] : '';
- $data['reverb_listing_id'] = $reverb_row ? $reverb_row['reverb_listing_id'] : '';
- $data['reverb_conditions'] = $this->model_extension_module_reverb->getListingConditions();
- $data['reverb_categories'] = $this->model_extension_module_reverb->getReverbCategories();
- ]]></add>
- </operation>
- <operation>
- <search><![CDATA[$this->model_catalog_product->editProduct($this->request->get['product_id'], $this->request->post);]]></search>
- <add position="after"><![CDATA[
- if (isset($this->request->post['reverb_sync_enabled']) || isset($this->request->post['reverb_condition_uuid'])) {
- $this->load->model('extension/module/reverb');
- $this->model_extension_module_reverb->saveProductMap((int)$this->request->get['product_id'], array(
- 'sync_enabled' => isset($this->request->post['reverb_sync_enabled']) ? 1 : 0,
- 'condition_uuid' => isset($this->request->post['reverb_condition_uuid']) ? $this->request->post['reverb_condition_uuid'] : '',
- 'reverb_category_uuid' => isset($this->request->post['reverb_category_uuid']) ? $this->request->post['reverb_category_uuid'] : '',
- ));
- }
- ]]></add>
- </operation>
- <operation>
- <search><![CDATA[$product_id = $this->model_catalog_product->addProduct($this->request->post);]]></search>
- <add position="after"><![CDATA[
- if (isset($this->request->post['reverb_sync_enabled']) || isset($this->request->post['reverb_condition_uuid'])) {
- $this->load->model('extension/module/reverb');
- $this->model_extension_module_reverb->saveProductMap((int)$product_id, array(
- 'sync_enabled' => isset($this->request->post['reverb_sync_enabled']) ? 1 : 0,
- 'condition_uuid' => isset($this->request->post['reverb_condition_uuid']) ? $this->request->post['reverb_condition_uuid'] : '',
- 'reverb_category_uuid' => isset($this->request->post['reverb_category_uuid']) ? $this->request->post['reverb_category_uuid'] : '',
- ));
- }
- ]]></add>
- </operation>
- </file>
- <!--
- ========================================================================
- FILE 2: admin/view/template/catalog/product.twig
- Add a "Reverb" tab to the product edit page.
- Anchored on the SEO tab (always present in OC3) rather than Design tab
- to avoid mismatches with customised themes. Content embedded inline to
- avoid Twig include path resolution issues.
- ========================================================================
- -->
- <file path="admin/view/template/catalog/product.twig">
- <operation>
- <search><![CDATA[<li><a href="#tab-seo" data-toggle="tab">{{ tab_seo }}</a></li>]]></search>
- <add position="after"><![CDATA[<li><a href="#tab-reverb" data-toggle="tab">Reverb</a></li>]]></add>
- </operation>
- <operation>
- <search><![CDATA[<div class="tab-pane" id="tab-seo">]]></search>
- <add position="before"><![CDATA[
- <div class="tab-pane" id="tab-reverb">
- <div class="panel panel-default" style="margin-top:15px;">
- <div class="panel-body">
- <div class="form-group">
- <label class="col-sm-2 control-label">List on Reverb</label>
- <div class="col-sm-10">
- <input type="hidden" name="reverb_sync_enabled" value="0" />
- <label class="checkbox-inline">
- <input type="checkbox" name="reverb_sync_enabled" value="1"
- {% if reverb_sync_enabled %}checked="checked"{% endif %} />
- Enable sync for this product
- </label>
- <p class="help-block">Enable to include this product in Reverb syncs. The product must also be in an allowed category (set in the Reverb module settings).</p>
- </div>
- </div>
- <div class="form-group">
- <label class="col-sm-2 control-label">Condition</label>
- <div class="col-sm-4">
- <select name="reverb_condition_uuid" class="form-control">
- <option value="">-- Select Condition --</option>
- {% for condition in reverb_conditions %}
- <option value="{{ condition.uuid }}"
- {% if reverb_condition_uuid == condition.uuid %}selected="selected"{% endif %}>
- {{ condition.display_name }}
- </option>
- {% endfor %}
- </select>
- <p class="help-block">Required by Reverb. Describes the physical state of the item.</p>
- </div>
- </div>
- <div class="form-group">
- <label class="col-sm-2 control-label">Reverb Category</label>
- <div class="col-sm-6">
- <select name="reverb_category_uuid" class="form-control">
- <option value="">-- Use category mapping default --</option>
- {% for rc in reverb_categories %}
- <option value="{{ rc.uuid }}"
- {% if reverb_category_uuid == rc.uuid %}selected="selected"{% endif %}>
- {{ rc.full_name|default(rc.name) }}
- </option>
- {% endfor %}
- </select>
- <p class="help-block">Leave blank to use the default mapping from the Reverb module settings.</p>
- </div>
- </div>
- {% if reverb_listing_id %}
- <div class="form-group">
- <label class="col-sm-2 control-label">Reverb Listing</label>
- <div class="col-sm-10">
- <p class="form-control-static">
- <a href="https://reverb.com/item/{{ reverb_listing_id }}" target="_blank" rel="noopener">
- <i class="fa fa-external-link"></i> View on Reverb (ID: {{ reverb_listing_id }})
- </a>
- </p>
- </div>
- </div>
- {% else %}
- <div class="form-group">
- <label class="col-sm-2 control-label">Reverb Listing</label>
- <div class="col-sm-10">
- <p class="form-control-static text-muted">Not yet synced to Reverb.</p>
- </div>
- </div>
- {% endif %}
- </div>
- </div>
- </div>
- ]]></add>
- </operation>
- </file>
- </modification>
|