Post by straightlight » Thu Mar 22, 2018 11:39 pm

Find:

Code: Select all

AND dd.language_id = '" . (int)$this->config->get('config_language_id') . "'
replace with:

Code: Select all

AND o.store_id = '" . (int)$this->config->get('config_store_id') . "' AND o.language_id = dd.language_id AND dd.language_id = '" . (int)$this->config->get('config_language_id') . "'
Then, find:

Code: Select all

AND d.download_id = '" . (int)$download_id . "'
replace with:

Code: Select all

AND o.language_id = '" . (int)$this->config->get('config_language_id') . "' AND d.download_id = '" . (int)$download_id . "'
Then, in the getTotalDownloads() method,

replace:

Code: Select all

WHERE o.customer_id = '" . (int)$this->customer->getId() . "' AND (" . implode(" OR ", $implode) . ")
with:

Code: Select all

WHERE o.language_id = '" . (int)$this->config->get('config_language_id') . "' AND o.store_id = '" . (int)$this->config->get('config_store_id') . "' AND o.customer_id = '" . (int)$this->customer->getId() . "' AND (" . implode(" OR ", $implode) . ")

The most generated errors being found on Opencart forum originates from contributed programming. The increased counters are caused by posted redundancies of the same solutions that were already provided prior.

F. Rules:

- viewtopic.php?f=176&t=200480
- viewtopic.php?f=176&t=200804


Regards,
Straightlight


Legendary Member

Posts

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

Post by straightlight » Fri Mar 23, 2018 9:05 pm

Followed is an alternative solution, compared to the bug report post above, based on merchants that wants to display all languages with all stores for the account downloads all on the same list: viewtopic.php?f=24&t=203124&p=718431#p718429

The most generated errors being found on Opencart forum originates from contributed programming. The increased counters are caused by posted redundancies of the same solutions that were already provided prior.

F. Rules:

- viewtopic.php?f=176&t=200480
- viewtopic.php?f=176&t=200804


Regards,
Straightlight


Legendary Member

Posts

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

Post by straightlight » Tue Mar 27, 2018 12:27 am

To proceed on the bug fixes, followed are expanded solution to get this done along with the other posts above aside from the previous reply which was about a conceptual idea (which I still recommend to be used).

In system/library/cart/cart.php file,

find:

Code: Select all

'download_id' => $download['download_id'],
add below:

Code: Select all

'product_id'  => $download['product_id'],
In catalog/model/account/order.php file,

find:

Code: Select all

public function getOrderOptions($order_id, $order_product_id) {
		$query = $this->db->query("SELECT * FROM " . DB_PREFIX . "order_option WHERE order_id = '" . (int)$order_id . "' AND order_product_id = '" . (int)$order_product_id . "'");

		return $query->rows;
	}
add below:

Code: Select all

public function getOrderDownload($filter_data) {
		$query = $this->db->query("SELECT * FROM `" . DB_PREFIX . "order_download` WHERE `download_id` = '" . (int)$filter_data['download_id'] . "', `order_id` = '" . (int)$filter_data['order_id'] . "', `store_id` = '" . (int)$filter_data['store_id'] . "'");
	}
In catalog/model/checkout/order.php file,

find all instances of:

Code: Select all

foreach ($product['option'] as $option) {
					$this->db->query("INSERT INTO " . DB_PREFIX . "order_option SET order_id = '" . (int)$order_id . "', order_product_id = '" . (int)$order_product_id . "', product_option_id = '" . (int)$option['product_option_id'] . "', product_option_value_id = '" . (int)$option['product_option_value_id'] . "', name = '" . $this->db->escape($option['name']) . "', `value` = '" . $this->db->escape($option['value']) . "', `type` = '" . $this->db->escape($option['type']) . "'");
				}
				
add below each:

Code: Select all

foreach ($product['download'] as $download) {
					if ((int)$download['product_id'] == (int)$product['product_id']) {
						this->db->query("INSERT INTO `" . DB_PREFIX . "order_download` SET `download_id` = '" . (int)$download['download_id'] . "', `order_id` = '" . (int)$order_id . "', `store_id` = '" . (int)$data['store_id'] . "'");
					}
				}
In PHPMyAdmin, on your Opencart database - > SQL tab, execute the following query:

Code: Select all

DROP TABLE IF EXISTS `oc_order_download`;
CREATE TABLE IF NOT EXISTS `oc_order_download` (
  `order_download_id` int(11) NOT NULL AUTO_INCREMENT,
  `order_id` int(11) NOT NULL,
  `store_id` int(11) NOT NULL,
  `download_id` int(11) NOT NULL,
  PRIMARY KEY (`order_download_id`,`order_id`,`store_id`,`download_id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci;
Note: Replace oc_ with your current database table prefix name if using another prefix. This should completely rectify the issue by adding a separate copy of the order ID along with the store ID and the download ID that originates with the associated product ID during checkout.

The most generated errors being found on Opencart forum originates from contributed programming. The increased counters are caused by posted redundancies of the same solutions that were already provided prior.

F. Rules:

- viewtopic.php?f=176&t=200480
- viewtopic.php?f=176&t=200804


Regards,
Straightlight


Legendary Member

Posts

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

Post by straightlight » Tue Mar 27, 2018 12:33 am

So far, the complete solutions have been posted. It should, now, be safe to apply these modifications as per your discretion. To be clear, the conceptual topic is only for sharing a new idea aside from the bug section as I do still recommend to consider them so that the merchant won't have to deal with broken SLAs with their customers nowadays.

The most generated errors being found on Opencart forum originates from contributed programming. The increased counters are caused by posted redundancies of the same solutions that were already provided prior.

F. Rules:

- viewtopic.php?f=176&t=200480
- viewtopic.php?f=176&t=200804


Regards,
Straightlight


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 2 guests