- Posts: 128
- Thank you received: 2
Consume serial based on pack
9 years 10 months ago #259474
by sabroso
Consume serial based on pack was created by sabroso
-- HikaShop version -- : 2.6.4
-- HikaSerial version -- : 1.10.4
-- Joomla version -- : 3.6.5
-- PHP version -- : 5.6
Hi there,
By looking into the Hikaserial.Serial controller code I realised in the consume URL you can pass the Pack ID or Pack Name as a parameter as well. This is not explained here:
www.hikashop.com/support/documentation/1...onsume-features.html
However when trying it out it does not work as there seems to be a bug on the SQL query to retrieve the serial by pack -> see Hikaserial.Serial Class -> function check() -> line 388. The filters seem to added outside the parenthesis
Anyway, I am wondering if this parameter is required at all. So the question is, if two different packs use the same generator, is it possible that the same serial appears in both packs? In other words, is it possible that there are NOT UNIQUE serials?
If that is the case (there could be repeated serials in different packs), then we need the bug fixed to be able to specify the pack when consuming a serial and avoid that the wrong serial gets consumed.
Thanks!
-- HikaSerial version -- : 1.10.4
-- Joomla version -- : 3.6.5
-- PHP version -- : 5.6
Hi there,
By looking into the Hikaserial.Serial controller code I realised in the consume URL you can pass the Pack ID or Pack Name as a parameter as well. This is not explained here:
www.hikashop.com/support/documentation/1...onsume-features.html
However when trying it out it does not work as there seems to be a bug on the SQL query to retrieve the serial by pack -> see Hikaserial.Serial Class -> function check() -> line 388. The filters seem to added outside the parenthesis
Code:
$query = 'SELECT a.*, b.pack_params FROM '.hikaserial::table('serial').' AS a INNER JOIN '.hikaserial::table('pack').' AS b '.
' ON a.serial_pack_id = b.pack_id '.
' WHERE (b.pack_published = 1 AND a.serial_data = '.$this->db->Quote($serial_data).') ' . implode(' AND ', $filters);
Anyway, I am wondering if this parameter is required at all. So the question is, if two different packs use the same generator, is it possible that the same serial appears in both packs? In other words, is it possible that there are NOT UNIQUE serials?
If that is the case (there could be repeated serials in different packs), then we need the bug fixed to be able to specify the pack when consuming a serial and avoid that the wrong serial gets consumed.
Thanks!
Please Log in or Create an account to join the conversation.
9 years 10 months ago #259476
by Jerome
Jerome - Obsidev.com
HikaMarket & HikaSerial developer / HikaShop core dev team.
Replied by Jerome on topic Consume serial based on pack
Hi,
1 - The filters are added outside the parenthesis yes, but there is no bug there.
2 - I'm not following you.
3 - about your last question
By definition, it is possible to have duplicate serials but it's not something that HikaSerial will do itself.
And that is why it is possible to specify the pack id or the pack name during the consumption so you can target a specific pack if you know that the serial can be duplicated depending your configuration and your data.
Regards,
1 - The filters are added outside the parenthesis yes, but there is no bug there.
2 - I'm not following you.
I realised in the consume URL you can pass the Pack ID or Pack Name as a parameter as well
You saw that there is an optional parameter so you know that this parameter is not required, but optional.I am wondering if this parameter is required at all
3 - about your last question
HikaSerial have options to be sure that generators won't create duplicate data but you can also import and create manually serials in your database. You can also use generators like "series" which can definitively generate the same serials in several packs because it's one of his goal.is it possible that there are NOT UNIQUE serials?
By definition, it is possible to have duplicate serials but it's not something that HikaSerial will do itself.
And that is why it is possible to specify the pack id or the pack name during the consumption so you can target a specific pack if you know that the serial can be duplicated depending your configuration and your data.
Regards,
Jerome - Obsidev.com
HikaMarket & HikaSerial developer / HikaShop core dev team.
Please Log in or Create an account to join the conversation.
9 years 10 months ago #259507
by sabroso
Replied by sabroso on topic Consume serial based on pack
Thanks Jerome,
OK, now I understand the Pack ID/Name is an optional parameter, maybe you could add this to your documentation?
However when I use it I get an SQL error message, that's why I thought it was a bug:
So how does Hikaserial ensure that two different generators do not issue the same serial number? Is this a parameter in the config somewhere? Is this built in by default? Anyway, I think to be on the safe side I should use the Pack ID parameter but we need to fix the SQL error.
Many thanks!
OK, now I understand the Pack ID/Name is an optional parameter, maybe you could add this to your documentation?
However when I use it I get an SQL error message, that's why I thought it was a bug:
Code:
1064
Error: 1064
You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'b.pack_id = 1' at line 1 SQL=SELECT a.*, b.pack_params FROM #__hikaserial_serial AS a INNER JOIN #__hikaserial_pack AS b ON a.serial_pack_id = b.pack_id WHERE (b.pack_published = 1 AND a.serial_data = 'Hiy4Nsq7JdRD') b.pack_id = 1
So how does Hikaserial ensure that two different generators do not issue the same serial number? Is this a parameter in the config somewhere? Is this built in by default? Anyway, I think to be on the safe side I should use the Pack ID parameter but we need to fix the SQL error.
Many thanks!
Please Log in or Create an account to join the conversation.
9 years 10 months ago - 9 years 10 months ago #259510
by Jerome
Jerome - Obsidev.com
HikaMarket & HikaSerial developer / HikaShop core dev team.
Replied by Jerome on topic Consume serial based on pack
Hi,
Okay, now I see what you're talking about.
In the class file, replace
By
And it will add the missing AND.
Regards,
Okay, now I see what you're talking about.
In the class file, replace
Code:
' WHERE (b.pack_published = 1 AND a.serial_data = '.$this->db->Quote($serial_data).') ' . implode(' AND ', $filters);
Code:
' WHERE (b.pack_published = 1 AND a.serial_data = '.$this->db->Quote($serial_data).')';
if(!empty($filters))
$query .= ' AND ' . implode(' AND ', $filters);
Regards,
Jerome - Obsidev.com
HikaMarket & HikaSerial developer / HikaShop core dev team.
Last edit: 9 years 10 months ago by Jerome.
Please Log in or Create an account to join the conversation.
9 years 10 months ago #259522
by sabroso
Replied by sabroso on topic Consume serial based on pack
Thank you, sorted
Please Log in or Create an account to join the conversation.
Moderators: Obsidev
Time to create page: 0.050 seconds