[Skip to main content](#vessel-content)

#   Consume serial based on pack

##

- **[sabroso](/forum/user/38789-sabroso "View sabroso's Profile")**
- [![sabroso's Avatar](https://www.hikashop.com/media/kunena/core/svg/person.svg)](/forum/user/38789-sabroso "View sabroso's Profile") Topic Author
- [ Offline](/forum/user/38789-sabroso)

Less More

- Posts: 128
- Thank you received: 2
-
-

9 years 10 months ago [\#259474](#259474) by [sabroso](/forum/user/38789-sabroso "View sabroso's Profile")  *[Consume serial based on pack](/forum/17-serial-how-to/888304-consume-serial-based-on-pack#259474 "-- 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 -&gt; see Hikaserial.Serial Class -&gt; function check() -&gt; 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!")* was created by *[sabroso](/forum/user/38789-sabroso "View sabroso's Profile")*

-- 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](https://www.hikashop.com/support/documentation/138-consume-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 -&gt; see Hikaserial.Serial Class -&gt; function check() -&gt; 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-&gt;db-&gt;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](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzE3LXNlcmlhbC1ob3ctdG8vODg4MzA0LWNvbnN1bWUtc2VyaWFsLWJhc2VkLW9uLXBhY2s/dG1wbD1tYXJrZG93bg==) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[Jerome](/forum/user/80-jerome "View Jerome's Profile")**
- [![Jerome's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar80.png)](/forum/user/80-jerome "View Jerome's Profile")
- [ Offline](/forum/user/80-jerome)
- HikaShop core developer

Less More

- Posts: 26401
- Thank you received: 4081
-
- [](http://obsi.dev)
-

9 years 10 months ago [\#259476](#259476) by [Jerome](/forum/user/80-jerome "View Jerome's Profile")  Replied by *[Jerome](/forum/user/80-jerome "View Jerome's Profile")* on topic *[Consume serial based on pack](/forum/17-serial-how-to/888304-consume-serial-based-on-pack#259476 "-- 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 -&gt; see Hikaserial.Serial Class -&gt; function check() -&gt; 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!")*

Hi,

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

> I am wondering if this parameter is required at all

You saw that there is an optional parameter so you know that this parameter is not required, but optional.

3 - about your last question

> is it possible that there are NOT UNIQUE serials?

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.
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 &amp; HikaSerial developer / HikaShop core dev team.

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzE3LXNlcmlhbC1ob3ctdG8vODg4MzA0LWNvbnN1bWUtc2VyaWFsLWJhc2VkLW9uLXBhY2s/dG1wbD1tYXJrZG93bg==) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[sabroso](/forum/user/38789-sabroso "View sabroso's Profile")**
- [![sabroso's Avatar](https://www.hikashop.com/media/kunena/core/svg/person.svg)](/forum/user/38789-sabroso "View sabroso's Profile") Topic Author
- [ Offline](/forum/user/38789-sabroso)

Less More

- Posts: 128
- Thank you received: 2
-
-

9 years 10 months ago [\#259507](#259507) by [sabroso](/forum/user/38789-sabroso "View sabroso's Profile")  Replied by *[sabroso](/forum/user/38789-sabroso "View sabroso's Profile")* on topic *[Consume serial based on pack](/forum/17-serial-how-to/888304-consume-serial-based-on-pack#259507 "-- 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 -&gt; see Hikaserial.Serial Class -&gt; function check() -&gt; 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!")*

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: 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](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzE3LXNlcmlhbC1ob3ctdG8vODg4MzA0LWNvbnN1bWUtc2VyaWFsLWJhc2VkLW9uLXBhY2s/dG1wbD1tYXJrZG93bg==) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[Jerome](/forum/user/80-jerome "View Jerome's Profile")**
- [![Jerome's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar80.png)](/forum/user/80-jerome "View Jerome's Profile")
- [ Offline](/forum/user/80-jerome)
- HikaShop core developer

Less More

- Posts: 26401
- Thank you received: 4081
-
- [](http://obsi.dev)
-

9 years 10 months ago -  9 years 10 months ago [\#259510](#259510) by [Jerome](/forum/user/80-jerome "View Jerome's Profile")  Replied by *[Jerome](/forum/user/80-jerome "View Jerome's Profile")* on topic *[Consume serial based on pack](/forum/17-serial-how-to/888304-consume-serial-based-on-pack#259510 "-- 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 -&gt; see Hikaserial.Serial Class -&gt; function check() -&gt; 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!")*

Hi,

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-&gt;db-&gt;Quote($serial_data).') ' . implode(' AND ', $filters);

By Code:

' WHERE (b.pack_published = 1 AND a.serial_data = '.$this-&gt;db-&gt;Quote($serial_data).')'; if(!empty($filters)) $query .= ' AND ' . implode(' AND ', $filters);

And it will add the missing AND.

Regards,

---

Jerome - Obsidev.com
HikaMarket &amp; HikaSerial developer / HikaShop core dev team.

Last edit: 9 years 10 months ago by [Jerome](/forum/user/80-jerome "View Jerome's Profile").

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzE3LXNlcmlhbC1ob3ctdG8vODg4MzA0LWNvbnN1bWUtc2VyaWFsLWJhc2VkLW9uLXBhY2s/dG1wbD1tYXJrZG93bg==) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[sabroso](/forum/user/38789-sabroso "View sabroso's Profile")**
- [![sabroso's Avatar](https://www.hikashop.com/media/kunena/core/svg/person.svg)](/forum/user/38789-sabroso "View sabroso's Profile") Topic Author
- [ Offline](/forum/user/38789-sabroso)

Less More

- Posts: 128
- Thank you received: 2
-
-

9 years 10 months ago [\#259522](#259522) by [sabroso](/forum/user/38789-sabroso "View sabroso's Profile")  Replied by *[sabroso](/forum/user/38789-sabroso "View sabroso's Profile")* on topic *[Consume serial based on pack](/forum/17-serial-how-to/888304-consume-serial-based-on-pack#259522 "-- 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 -&gt; see Hikaserial.Serial Class -&gt; function check() -&gt; 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!")*

Thank you, sorted ![:)](/media/kunena/emoticons/3.png ":)")

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzE3LXNlcmlhbC1ob3ctdG8vODg4MzA0LWNvbnN1bWUtc2VyaWFsLWJhc2VkLW9uLXBhY2s/dG1wbD1tYXJrZG93bg==) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

Board Categories HikaShop Install &amp; Update Product &amp; Category Display Content Creation Sales and Orders Orders management Reports &amp; Statistics Customers Checkout Payment Methods Shipping Methods Import &amp; Export (CSV, XLS…) Specific Features Affilation Taxes Wishlist Vote Carousel &amp; Slider Mass Actions Filters &amp; Search Discount &amp; Coupon Feature Request Integrations Showcase General Talk about HikaShop Development HikaShop 3.0 Beta Translation Commercial Jobs HikaShop Components HikaMarket Market: Feature requests Market: How to? Market: Bug Report HikaSerial General talk about HikaSerial Serial: Bug Report Serial: How to? Support en Français de HikaSerial (French Support) HikaSubscription HikaAuction Auction: Feature requests Auction: How to? Auction: Bug report Hikashop around the world Support en Français (French Support) Russian FAQ. Курс выживания с Hikashop. Частые вопросы и о Расширения Hikashop Наши сайты на Hikashop 日本語版サポート(Japanese Support) Thai German Archives Bug Report How to?

Moderators: [Obsidev](/forum/user/7040-obsidev "View Obsidev's Profile")

[](/forum/topics/feed/mode-topics?format=feed&type=rss)

Time to create page: 0.049 seconds

[Powered by](/forum/credits) [Kunena Forum](https://www.kunena.org)
