Page 5 of 5

Re: 3.0.3.x Issues and Bugs

Posted: Fri Apr 03, 2020 5:39 pm
by moshair
straightlight wrote:
Fri Apr 03, 2020 6:51 am
Take note that adding custom fields into the invoice may result dealing with split invoice template between pages. Only use the following if considering to use split pages if you cannot configure your printer driver to a fit landscape.

In admin/controller/sale/order.php file, in the invoice() method,

find:

Code: Select all

foreach ($orders as $order_id) {
add above:

Code: Select all

$this->load->model('customer/custom_field');
Then, find - still in the invoice() method:

Code: Select all

$data['orders'][] = array(
add above:

Code: Select all

$account_custom_fields = array();

				$filter_data = array(
					'sort'  => 'cf.sort_order',
					'order' => 'ASC'
				);

				$custom_fields = $this->model_customer_custom_field->getCustomFields($filter_data);

				foreach ($custom_fields as $custom_field) {
					if ($custom_field['location'] == 'account' && isset($order_info['custom_field'][$custom_field['custom_field_id']])) {
						if ($custom_field['type'] == 'select' || $custom_field['type'] == 'radio') {
							$custom_field_value_info = $this->model_customer_custom_field->getCustomFieldValue($order_info['custom_field'][$custom_field['custom_field_id']]);

							if ($custom_field_value_info) {
								$account_custom_fields[] = array(
									'name'  => $custom_field['name'],
									'value' => $custom_field_value_info['name']
								);
							}
						}

						if ($custom_field['type'] == 'checkbox' && is_array($order_info['custom_field'][$custom_field['custom_field_id']])) {
							foreach ($order_info['custom_field'][$custom_field['custom_field_id']] as $custom_field_value_id) {
								$custom_field_value_info = $this->model_customer_custom_field->getCustomFieldValue($custom_field_value_id);

								if ($custom_field_value_info) {
									$account_custom_fields[] = array(
										'name'  => $custom_field['name'],
										'value' => $custom_field_value_info['name']
									);
								}
							}
						}

						if ($custom_field['type'] == 'text' || $custom_field['type'] == 'textarea' || $custom_field['type'] == 'file' || $custom_field['type'] == 'date' || $custom_field['type'] == 'datetime' || $custom_field['type'] == 'time') {
							$account_custom_fields[] = array(
								'name'  => $custom_field['name'],
								'value' => $order_info['custom_field'][$custom_field['custom_field_id']]
							);
						}

						if ($custom_field['type'] == 'file') {
							$upload_info = $this->model_tool_upload->getUploadByCode($order_info['custom_field'][$custom_field['custom_field_id']]);

							if ($upload_info) {
								$account_custom_fields[] = array(
									'name'  => $custom_field['name'],
									'value' => $upload_info['name']
								);
							}
						}
					}
				}

				// Custom fields
				$payment_custom_fields = array();

				foreach ($custom_fields as $custom_field) {
					if ($custom_field['location'] == 'address' && isset($order_info['payment_custom_field'][$custom_field['custom_field_id']])) {
						if ($custom_field['type'] == 'select' || $custom_field['type'] == 'radio') {
							$custom_field_value_info = $this->model_customer_custom_field->getCustomFieldValue($order_info['payment_custom_field'][$custom_field['custom_field_id']]);

							if ($custom_field_value_info) {
								$payment_custom_fields[] = array(
									'name'  => $custom_field['name'],
									'value' => $custom_field_value_info['name'],
									'sort_order' => $custom_field['sort_order']
								);
							}
						}

						if ($custom_field['type'] == 'checkbox' && is_array($order_info['payment_custom_field'][$custom_field['custom_field_id']])) {
							foreach ($order_info['payment_custom_field'][$custom_field['custom_field_id']] as $custom_field_value_id) {
								$custom_field_value_info = $this->model_customer_custom_field->getCustomFieldValue($custom_field_value_id);

								if ($custom_field_value_info) {
									$payment_custom_fields[] = array(
										'name'  => $custom_field['name'],
										'value' => $custom_field_value_info['name'],
										'sort_order' => $custom_field['sort_order']
									);
								}
							}
						}

						if ($custom_field['type'] == 'text' || $custom_field['type'] == 'textarea' || $custom_field['type'] == 'file' || $custom_field['type'] == 'date' || $custom_field['type'] == 'datetime' || $custom_field['type'] == 'time') {
							$payment_custom_fields[] = array(
								'name'  => $custom_field['name'],
								'value' => $order_info['payment_custom_field'][$custom_field['custom_field_id']],
								'sort_order' => $custom_field['sort_order']
							);
						}

						if ($custom_field['type'] == 'file') {
							$upload_info = $this->model_tool_upload->getUploadByCode($order_info['payment_custom_field'][$custom_field['custom_field_id']]);

							if ($upload_info) {
								$payment_custom_fields[] = array(
									'name'  => $custom_field['name'],
									'value' => $upload_info['name'],
									'sort_order' => $custom_field['sort_order']
								);
							}
						}
					}
				}

				// Shipping
				$shipping_custom_fields = array();

				foreach ($custom_fields as $custom_field) {
					if ($custom_field['location'] == 'address' && isset($order_info['shipping_custom_field'][$custom_field['custom_field_id']])) {
						if ($custom_field['type'] == 'select' || $custom_field['type'] == 'radio') {
							$custom_field_value_info = $this->model_customer_custom_field->getCustomFieldValue($order_info['shipping_custom_field'][$custom_field['custom_field_id']]);

							if ($custom_field_value_info) {
								$shipping_custom_fields[] = array(
									'name'  => $custom_field['name'],
									'value' => $custom_field_value_info['name'],
									'sort_order' => $custom_field['sort_order']
								);
							}
						}

						if ($custom_field['type'] == 'checkbox' && is_array($order_info['shipping_custom_field'][$custom_field['custom_field_id']])) {
							foreach ($order_info['shipping_custom_field'][$custom_field['custom_field_id']] as $custom_field_value_id) {
								$custom_field_value_info = $this->model_customer_custom_field->getCustomFieldValue($custom_field_value_id);

								if ($custom_field_value_info) {
									$shipping_custom_fields[] = array(
										'name'  => $custom_field['name'],
										'value' => $custom_field_value_info['name'],
										'sort_order' => $custom_field['sort_order']
									);
								}
							}
						}

						if ($custom_field['type'] == 'text' || $custom_field['type'] == 'textarea' || $custom_field['type'] == 'file' || $custom_field['type'] == 'date' || $custom_field['type'] == 'datetime' || $custom_field['type'] == 'time') {
							$shipping_custom_fields[] = array(
								'name'  => $custom_field['name'],
								'value' => $order_info['shipping_custom_field'][$custom_field['custom_field_id']],
								'sort_order' => $custom_field['sort_order']
							);
						}

						if ($custom_field['type'] == 'file') {
							$upload_info = $this->model_tool_upload->getUploadByCode($order_info['shipping_custom_field'][$custom_field['custom_field_id']]);

							if ($upload_info) {
								$shipping_custom_fields[] = array(
									'name'  => $custom_field['name'],
									'value' => $upload_info['name'],
									'sort_order' => $custom_field['sort_order']
								);
							}
						}
					}
				}
Then, in admin/view/template/sale/order_invoice.twig file,

find:

Code: Select all

<b>{{ text_email }}</b> {{ order.store_email }}<br />
add below:

Code: Select all

{% if order.account_custom_fields %}
			  <table class="table table-bordered">
				<thead>
				  <tr>
					<td colspan="2">{{ text_account_custom_field }}</td>
				  </tr>
				</thead>
				<tbody>
				  {% for custom_field in order.account_custom_fields %}
					<tr>
					  <td>{{ custom_field.name }}</td>
					  <td>{{ custom_field.value }}</td>
					</tr>
				  {% endfor %}
				</tbody>
			  </table>
			  <br />
			{% endif %}
Then, find:

Code: Select all

<b>{{ text_payment_method }}</b> {{ order.payment_method }}<br />
add below:

Code: Select all

{% if order.payment_custom_fields %}
			  <table class="table table-bordered">
				<thead>
				  <tr>
					<td colspan="2">{{ text_payment_custom_field }}</td>
				  </tr>
				</thead>
				<tbody>
				  {% for custom_field in order.payment_custom_fields %}
					<tr>
					  <td>{{ custom_field.name }}</td>
					  <td>{{ custom_field.value }}</td>
					</tr>
				  {% endfor %}
				</tbody>
			  </table>
			  <br />
			{% endif %}
Then, find:

Code: Select all

<b>{{ text_shipping_method }}</b> {{ order.shipping_method }}
add below:

Code: Select all

{% if order.shipping_custom_fields %}
			  <table class="table table-bordered">
				<thead>
				  <tr>
					<td colspan="2">{{ text_shipping_custom_field }}</td>
				  </tr>
				</thead>
				<tbody>
				  {% for custom_field in order.shipping_custom_fields %}
					<tr>
					  <td>{{ custom_field.name }}</td>
					  <td>{{ custom_field.value }}</td>
					</tr>
				  {% endfor %}
				</tbody>
			  </table>
			{% endif %}
Then, follow this FAQ: viewtopic.php?f=134&t=215776#p718325

You can re-arrange the invoice presentation as you see fit.
Thank you.
Note: You forget to mention adding

Code: Select all

'shipping_custom_fields' => $shipping_custom_fields,
'payment_custom_fields' => $payment_custom_fields,

to

Code: Select all

$data['orders'][] = array(
Regards,

Re: 3.0.3.x Issues and Bugs

Posted: Fri Apr 03, 2020 7:08 pm
by straightlight
moshair wrote:
Fri Apr 03, 2020 5:39 pm
Thank you.
Note: You forget to mention adding

'shipping_custom_fields' => $shipping_custom_fields,
'payment_custom_fields' => $payment_custom_fields,
I have now also added the account_custom_fields in the $data['orders'] array in the mean time.

Re: 3.0.3.x Issues and Bugs

Posted: Sat Apr 04, 2020 5:38 pm
by moshair
straightlight wrote:
Fri Apr 03, 2020 7:08 pm
moshair wrote:
Fri Apr 03, 2020 5:39 pm
Thank you.
Note: You forget to mention adding

'shipping_custom_fields' => $shipping_custom_fields,
'payment_custom_fields' => $payment_custom_fields,
I have now also added the account_custom_fields in the $data['orders'] array in the mean time.
👍 Thank you.

Re: 3.0.3.x Issues and Bugs

Posted: Wed May 06, 2020 9:54 am
by ocusername
UPDATE:
I turned "Google Shopping" module back ON and everything is still working perfectly when creating new products, or new copied products. Strange but, no more problems !

I hope this fix helps other people like myself who are not developers and don't know anything about programming.

PROBLEM:
I fixed an issue mentioned here regarding:

Code: Select all

 PHP Fatal error:  Uncaught exception 'Exception' with message 'Error: Duplicate entry '0' for key 'PRIMARY'<br />Error No: 1062<br />INSERT INTO `oc_product_advertise_google` (`product_id`, `store_id`, `google_product_category`) 
 
After installing a fresh copy of Opencart-3.0.31 and Journal-3 theme everything worked perfect except when I tried to create a new product when clicking the save button everything went blank and it seemed like the new product or the products I tried to copy did not get saved but actually after refreshing the broswer and going back to products page I found the new product or new copied products were actualy saved there and sometimes there were even multiple copies of the exact new product saved . In my CPanel I went to ADMIN folder and inside I found the "error_log" file. I viwed that file and thats how I found the error code above.

SOLUTION:
Thanks to other people posting here that this is an issue with the Opencart-3 Extension- Advertising-Google Shopping I deleted the Google Shopping Advertisement Extension and evrything works perfect.
1 ) I went to Opencart Admin
2 ) then to Extensions > then Extensions >> (submenu)
3 ) then I selected "Advertising" from the Extensions Drop Down Menu
When the "Google Shopping" module appeared I cliked on the Red "Delete" button to remove it from my Opencart.

Re: 3.0.3.x Issues and Bugs

Posted: Wed May 06, 2020 7:33 pm
by straightlight
ocusername wrote:
Wed May 06, 2020 9:54 am
UPDATE:
I turned "Google Shopping" module back ON and everything is still working perfectly when creating new products, or new copied products. Strange but, no more problems !

I hope this fix helps other people like myself who are not developers and don't know anything about programming.

PROBLEM:
I fixed an issue mentioned here regarding:

Code: Select all

 PHP Fatal error:  Uncaught exception 'Exception' with message 'Error: Duplicate entry '0' for key 'PRIMARY'<br />Error No: 1062<br />INSERT INTO `oc_product_advertise_google` (`product_id`, `store_id`, `google_product_category`) 
 
After installing a fresh copy of Opencart-3.0.31 and Journal-3 theme everything worked perfect except when I tried to create a new product when clicking the save button everything went blank and it seemed like the new product or the products I tried to copy did not get saved but actually after refreshing the broswer and going back to products page I found the new product or new copied products were actualy saved there and sometimes there were even multiple copies of the exact new product saved . In my CPanel I went to ADMIN folder and inside I found the "error_log" file. I viwed that file and thats how I found the error code above.

SOLUTION:
Thanks to other people posting here that this is an issue with the Opencart-3 Extension- Advertising-Google Shopping I deleted the Google Shopping Advertisement Extension and evrything works perfect.
1 ) I went to Opencart Admin
2 ) then to Extensions > then Extensions >> (submenu)
3 ) then I selected "Advertising" from the Extensions Drop Down Menu
When the "Google Shopping" module appeared I cliked on the Red "Delete" button to remove it from my Opencart.
Already fixed on the master branch.

Re: 3.0.3.x Issues and Bugs

Posted: Thu May 21, 2020 7:43 pm
by xxvirusxx
Coupon pagination multi language fix: admin/controller/marketing/coupon.php

line 552 change this:

Code: Select all

'Showing %d to %d of %d (%d Pages)'
with this:

Code: Select all

$this->language->get('text_pagination')
Same issue in Master Branch but are too lazy to click on commit :laugh: reported in December 2019 :laugh:

Re: 3.0.3.x Issues and Bugs

Posted: Thu May 21, 2020 7:50 pm
by straightlight
xxvirusxx wrote:
Thu May 21, 2020 7:43 pm
Coupon pagination multi language fix: admin/controller/marketing/coupon.php

line 552 change this:

Code: Select all

'Showing %d to %d of %d (%d Pages)'
with this:

Code: Select all

$this->language->get('text_pagination')
Same issue in Master Branch but are too lazy to click on commit :laugh: reported in December 2019 :laugh:
Well, there's especially no need to wait all this time to publish such solutions where one would already know the answer about in order to create that commit and that is, if, the commit really hasn't been created in the first place on Github Opencart already.

Re: 3.0.3.x Issues and Bugs

Posted: Thu May 21, 2020 7:52 pm
by xxvirusxx
Commit is here....

https://github.com/opencart/opencart/pull/7785/files

I work again on 3.0.3.3 to add fixes and I remember of this :)

Re: 3.0.3.x Issues and Bugs

Posted: Thu May 21, 2020 7:55 pm
by straightlight
xxvirusxx wrote:
Thu May 21, 2020 7:52 pm
Commit is here....

https://github.com/opencart/opencart/pull/7785/files

I work again on 3.0.3.3 to add fixes and I remember of this :)
Ah ! here it is. On your last post, this commit wasn't posted. Thanks for clarifying that.

Re: 3.0.3.x Issues and Bugs

Posted: Sat Jun 06, 2020 8:33 pm
by turron16
I have found a security bug in OpenCart. But I'm not able to PM the administrators. How do I do so?
PS. Do you guys award bug bounty?

Re: 3.0.3.x Issues and Bugs

Posted: Sun Jun 07, 2020 5:30 am
by straightlight
turron16 wrote:
Sat Jun 06, 2020 8:33 pm
I have found a security bug in OpenCart. But I'm not able to PM the administrators. How do I do so?
PS. Do you guys award bug bounty?
Use the Contact us link at the bottom of the site to contact the Opencart team regarding your inquiry.

Re: 3.0.3.x Issues and Bugs

Posted: Tue Jun 16, 2020 12:56 am
by webmedialdh
In 3.0.3.3 version, notice that on the time of edit orders from the backend. If we have custom fields for the address then it sends the data as

Code: Select all

 custom_field[$custom_field['custom_field_id']] 
but in the API controller it like that

Code: Select all

 $this->request->post['custom_field'][$custom_field['location']][$custom_field['custom_field_id']] 
so location array not found thus it not allow users to edit the orders if have custom fields

Regards

Re: 3.0.3.x Issues and Bugs

Posted: Tue Jun 16, 2020 6:28 am
by straightlight
webmedialdh wrote:
Tue Jun 16, 2020 12:56 am
In 3.0.3.3 version, notice that on the time of edit orders from the backend. If we have custom fields for the address then it sends the data as

Code: Select all

 custom_field[$custom_field['custom_field_id']] 
but in the API controller it like that

Code: Select all

 $this->request->post['custom_field'][$custom_field['location']][$custom_field['custom_field_id']] 
so location array not found thus it not allow users to edit the orders if have custom fields

Regards
Where do you notice the custom_field[$custom_field['custom_field_id']] ? More information is needed.

Re: 3.0.3.x Issues and Bugs

Posted: Tue Jun 16, 2020 4:01 pm
by webmedialdh
straightlight wrote:
Tue Jun 16, 2020 6:28 am
webmedialdh wrote:
Tue Jun 16, 2020 12:56 am
In 3.0.3.3 version, notice that on the time of edit orders from the backend. If we have custom fields for the address then it sends the data as

Code: Select all

 custom_field[$custom_field['custom_field_id']] 
but in the API controller it like that

Code: Select all

 $this->request->post['custom_field'][$custom_field['location']][$custom_field['custom_field_id']] 
so location array not found thus it not allow users to edit the orders if have custom fields

Regards
Where do you notice the custom_field[$custom_field['custom_field_id']] ? More information is needed.

Hi Sir,

on the admin side:admin/view/template/sale/order_form.twig in the payment and shipping tabs
custom fields name are like custom_field[custom_field_id]
http://prntscr.com/t0kq5a

however, on the catalog side: api/payment/address and on api/shipping/address custom fields value are as follow
custom_field[location][custom_field_id]
http://prntscr.com/t0ktum

so when a user tries to edit the order it does not complete as custom field required error occurs

Regards

Re: 3.0.3.x Issues and Bugs

Posted: Tue Jun 16, 2020 7:28 pm
by straightlight
Already fixed on the master branch and the pre-release version.

Customer Searches Report - Paging Issue

Posted: Sat Aug 22, 2020 11:42 pm
by neptuneuk
Hi,

OC Version: 3.0.3.2

When you have run a 'Customer Searches Report' and move forward through the result set pages, when trying to return to the first page of the result set you are unable to do so (the url is malformed, as to reload the currently displayed result set page) e.g:
https://store.example.com/admin/index.p ... rch&page=3
as opposed to
https://store.example.com/admin/index.p ... mer_search

The same is true when using the 'previous page' icon '<' when you have arrived at page 2. You are unable to display page 1 as the url behind '<' is malformed, e.g when displaying page 2 the previous page '<' url is:
https://store.example.com/admin/index.p ... rch&page=2
presumably this should be:
https://store.example.com/admin/index.p ... mer_search

The correct behaviour seems to be present in all other reports I have tried, it seems to be isolated to 'Customer Searches Reports' only.

Re: 3.0.3.x Issues and Bugs

Posted: Sun Aug 23, 2020 12:32 am
by ADD Creative

Re: 3.0.3.x Issues and Bugs

Posted: Sun Oct 18, 2020 9:16 pm
by lz1nud
OC 3.0.3.6 , currency rate is not changing, even if I press manual refresh, nothing happens. Is it only me, or it is a bug?

Re: 3.0.3.x Issues and Bugs

Posted: Sun Oct 18, 2020 9:53 pm
by straightlight
lz1nud wrote:
Sun Oct 18, 2020 9:16 pm
OC 3.0.3.6 , currency rate is not changing, even if I press manual refresh, nothing happens. Is it only me, or it is a bug?
I posted a solution recently about currency fix. This might be related from the master branch:

- https://github.com/opencart/opencart/pull/8723
- https://github.com/opencart/opencart/pull/8720
- https://github.com/opencart/opencart/pull/8717

One from condor2:

- https://github.com/opencart/opencart/pull/8250

Re: 3.0.3.x Issues and Bugs

Posted: Tue Nov 24, 2020 8:43 pm
by OSWorX
Not loading modified admin templates
Replace the modification.xml (until OC 3.0.3.6) with that here:
https://github.com/opencart/opencart/bl ... cation.xml