Page 1 of 1

[v3.0.2.0 - Fix] - Admin Catalog Product Recurring Saves

Posted: Sun Oct 01, 2017 7:41 pm
by straightlight
Many users have posted an issue regarding the admin catalog product recurring saves action showing a recurring ID undefined index error message when not using the recurring on the form. In order to fix this, follow the steps below.

In admin/model/catalog/product.php file,

find all instances of:

Code: Select all

if (isset($data['product_recurring'])) {
			foreach ($data['product_recurring'] as $recurring) {
				$this->db->query("INSERT INTO `" . DB_PREFIX . "product_recurring` SET `product_id` = " . (int)$product_id . ", customer_group_id = " . (int)$recurring['customer_group_id'] . ", `recurring_id` = " . (int)$recurring['recurring_id']);
			}
		}
replace, each, with:

Code: Select all

if (isset($data['product_recurring'])) {
			foreach ($data['product_recurring'] as $recurring) {
				if (array_key_exists('recurring_id', $recurring)) {
					$this->db->query("INSERT INTO `" . DB_PREFIX . "product_recurring` SET `product_id` = " . (int)$product_id . ", customer_group_id = " . (int)$recurring['customer_group_id'] . ", `recurring_id` = " . (int)$recurring['recurring_id']);
				}
			}
		}
This should resolve the problem.

Re: [v3.0.2.0 - Fix] - Admin Catalog Product Recurring Saves

Posted: Tue Oct 24, 2017 3:09 pm
by burakcarkci
Thank you!! It worked.

Re: [v3.0.2.0 - Fix] - Admin Catalog Product Recurring Saves

Posted: Mon Oct 28, 2019 1:11 pm
by kizocart
but , some times this problem come especially if you are using another language for admin panel (not English) in this case check
Settings ---> localization ---> stock id
if there are translations for it or no

if not just hit + icon and add
in stock
out of stock
2-3 days
pre-order

Re: [v3.0.2.0 - Fix] - Admin Catalog Product Recurring Saves

Posted: Tue Nov 19, 2019 3:21 am
by straightlight
kizocart wrote:
Mon Oct 28, 2019 1:11 pm
but , some times this problem come especially if you are using another language for admin panel (not English) in this case check
Settings ---> localization ---> stock id
if there are translations for it or no

if not just hit + icon and add
in stock
out of stock
2-3 days
pre-order
I see your point. That would be correct. There seem to be missing validations, even in OC v3.0.3.2 release that may need to be addressed when validating recurring products from the admin catalog products page whenever a language may of may not have been defined from the settings - > localisation - > stock ID since the admin catalog products page also contains the stock status ID where this field links with a language ID that, yet, needs to be ensured to be configured before officially saving the product.

To solved this issue, I have attached the three files that now validates 95% of the associations with other features on the database:

- admin/controller/catalog/product.php
- admin/language/en-gb/catalog/product.php

for v3.0.3.2 release. To those who are using a lower OC version, feel free to compare.

As for the: admin/view/template/catalog/product_form.twig, here it is:

Code: Select all

  <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">&times;</button>
      </div>
    {% endif %}
	{% if error_language %}
      <div class="alert alert-danger alert-dismissible"><i class="fa fa-exclamation-circle"></i> {{ error_language }}
        <button type="button" class="close" data-dismiss="alert">&times;</button>
      </div>
    {% endif %}
	{% if error_product_recurring_description %}
      <div class="alert alert-danger alert-dismissible"><i class="fa fa-exclamation-circle"></i> {{ error_product_recurring_description }}
        <button type="button" class="close" data-dismiss="alert">&times;</button>
      </div>
    {% endif %}
	{% if error_product_stock_status_description %}
      <div class="alert alert-danger alert-dismissible"><i class="fa fa-exclamation-circle"></i> {{ error_product_stock_status_description }}
        <button type="button" class="close" data-dismiss="alert">&times;</button>
      </div>
    {% endif %}
	{% if error_product_attribute_description %}
      <div class="alert alert-danger alert-dismissible"><i class="fa fa-exclamation-circle"></i> {{ error_product_attribute_description }}
        <button type="button" class="close" data-dismiss="alert">&times;</button>
      </div>
    {% endif %}
	{% if error_product_filter %}
      <div class="alert alert-danger alert-dismissible"><i class="fa fa-exclamation-circle"></i> {{ error_product_filter }}
        <button type="button" class="close" data-dismiss="alert">&times;</button>
      </div>
    {% endif %}
	{% if error_product_filter_description %}
      <div class="alert alert-danger alert-dismissible"><i class="fa fa-exclamation-circle"></i> {{ error_product_filter_description }}
        <button type="button" class="close" data-dismiss="alert">&times;</button>
      </div>
    {% endif %}
	{% if error_product_option_description %}
      <div class="alert alert-danger alert-dismissible"><i class="fa fa-exclamation-circle"></i> {{ error_product_option_description }}
        <button type="button" class="close" data-dismiss="alert">&times;</button>
      </div>
    {% endif %}
	{% if error_product_value_description %}
      <div class="alert alert-danger alert-dismissible"><i class="fa fa-exclamation-circle"></i> {{ error_product_value_description }}
        <button type="button" class="close" data-dismiss="alert">&times;</button>
      </div>
    {% endif %}
	{% if error_product_reward_description %}
      <div class="alert alert-danger alert-dismissible"><i class="fa fa-exclamation-circle"></i> {{ error_product_reward_description }}
        <button type="button" class="close" data-dismiss="alert">&times;</button>
      </div>
    {% endif %}
	{% if error_product_download_description %}
      <div class="alert alert-danger alert-dismissible"><i class="fa fa-exclamation-circle"></i> {{ error_product_download_description }}
        <button type="button" class="close" data-dismiss="alert">&times;</button>
      </div>
    {% endif %}
	{% if error_product_layout_description %}
      <div class="alert alert-danger alert-dismissible"><i class="fa fa-exclamation-circle"></i> {{ error_product_layout_description }}
        <button type="button" class="close" data-dismiss="alert">&times;</button>
      </div>
    {% endif %}
	{% if error_product_store %}
      <div class="alert alert-danger alert-dismissible"><i class="fa fa-exclamation-circle"></i> {{ error_product_store }}
        <button type="button" class="close" data-dismiss="alert">&times;</button>
      </div>
    {% endif %}    
...

and so on. The rest of the TWIG file, either before or after, don't need to be modified in this case. The first line of this TWIG file is where it needs to be looked before adding the extra lines below.