Post by straightlight » Sun Oct 01, 2017 7:41 pm

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.

Dedication and passion goes to those who are able to push and merge a project.

Regards,
Straightlight
Programmer / Opencart Tester


Legendary Member

Posts

Joined
Mon Nov 14, 2011 11:38 pm
Location - Canada, ON

Post by burakcarkci » Tue Oct 24, 2017 3:09 pm

Thank you!! It worked.

Newbie

Posts

Joined
Thu Sep 28, 2017 11:41 am

Post by kizocart » 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

Newbie

Posts

Joined
Mon Sep 18, 2017 10:56 am

Post by straightlight » Tue Nov 19, 2019 3:21 am

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.

Dedication and passion goes to those who are able to push and merge a project.

Regards,
Straightlight
Programmer / Opencart Tester


Legendary Member

Posts

Joined
Mon Nov 14, 2011 11:38 pm
Location - Canada, ON
Who is online

Users browsing this forum: No registered users and 187 guests