Page 2 of 2

Re: Magneto Integration

PostPosted: Thu Mar 10, 2016 12:55 am
by Ahmed
Now SOAP requests are working but I just noticed that its not exporting all products to magento from Jiwa inventory.

Items in Database of Demo Jiwa Inventory are more then 260, but its exporting only 20 Items to magento.

When I try to Export Jiwa Inventory Items for 2nd time Logs shows this

START 'Export Jiwa Inventory Items'
Found 0 items in queue 'Jiwa Inventory'
END 'Export Jiwa Inventory Items'

Is there any settings to add/remove jiwa products to export queue ? or I'm missing something else ?

Thanks

Re: Magneto Integration

PostPosted: Thu Mar 10, 2016 5:34 pm
by Ahmed
ok found out that to refresh the Inventory Items queue for the missing products (if there are any) you have to refresh the queue by running the SQL query : UPDATE IN_Main SET Description = Description
This script will fire the trigger and all the products will be added to queue

Thanks

Re: Magneto Integration

PostPosted: Thu Mar 10, 2016 8:16 pm
by Mike.Sheen
Ahmed wrote:...And it worked. Its not the best solution but I don't know why magento is adding extra character when it returns the content. Will find proper reason & update here.


Is it maybe a character set / encoding / language issue? Is the response including a byte order mark which is not expected?

Re: Magneto Integration

PostPosted: Thu Mar 10, 2016 8:19 pm
by Mike.Sheen
Ahmed wrote:ok found out that to refresh the Inventory Items queue for the missing products (if there are any) you have to refresh the queue by running the SQL query : UPDATE IN_Main SET Description = Description
This script will fire the trigger and all the products will be added to queue

Thanks


Awesome - I'm glad you worked that out!

Re: Magneto Integration

PostPosted: Thu Mar 10, 2016 10:38 pm
by Ahmed
Hello Mike,

Another Question, don't know if I should create a new topic for it ?

I want to export Jiwa Inventory Items from only a one Category to Magento. In my Jiwa Inventory there are more then 10k products which I don't need to export but are historical data.

Suppose I want to export Category -> Brand -> "ABC"

So how can I add Items to queue only with Brand name ABC ?

Please let me know if there is anyway to achieve that

Thanks

Re: Magneto Integration

PostPosted: Thu Mar 10, 2016 10:44 pm
by Ahmed
Is it maybe a character set / encoding / language issue? Is the response including a byte order mark which is not expected?


Yes I think response is adding extra space in the start or end of the response content which is causing +1 difference in length. Just a guess don't know exactly but its working for me now

Thanks

Re: Magneto Integration

PostPosted: Sat Mar 12, 2016 10:48 am
by Mike.Sheen
Ahmed wrote:Hello Mike,

Another Question, don't know if I should create a new topic for it ?

I want to export Jiwa Inventory Items from only a one Category to Magento. In my Jiwa Inventory there are more then 10k products which I don't need to export but are historical data.

Suppose I want to export Category -> Brand -> "ABC"

So how can I add Items to queue only with Brand name ABC ?

Please let me know if there is anyway to achieve that

Thanks


A new topic would have been good - as this was already marked as solved by yourself so I missed your question when looking for unsolved topics!

The candidates for export are determined by a trigger on the IN_Main table - so you can simply modify that trigger - below is the SQL script to re-create the trigger on IN_Main and only export items where the Category1 in Jiwa is 'XYZ':

Code: Select all
IF EXISTS(SELECT *  FROM sys.triggers WHERE Name = 'IN_Main_Magento_ChangedInventoryItemQueue')
   DROP TRIGGER IN_Main_Magento_ChangedInventoryItemQueue
GO

CREATE TRIGGER IN_Main_Magento_ChangedInventoryItemQueue ON IN_Main AFTER INSERT, UPDATE, DELETE
AS
   SET NOCOUNT ON

   -- We only ever have one entry per product in the queue "Jiwa Inventory" - as this table is a queue
   -- we do nothing if the item is already in the table, as when we process this queue we grab the oldest first
   -- so this way we make sure no item gets neglected when there are high volumes
      
   -- update any existing entries with a new LastChangedDateTime
   UPDATE Magento_Queue
   SET LastChangedDateTime = GETDATE()
   FROM inserted i
   WHERE Magento_Queue.Identifier = i.PartNo
   AND Magento_Queue.QueueName = 'Jiwa Inventory'
   AND Magento_Queue.Status = 0

   -- Add the new entries   
   DECLARE @PartNos TABLE (
      PartNo VARCHAR(50) NOT NULL
   )

   INSERT INTO @PartNos SELECT DISTINCT IN_Main.PartNo FROM inserted i
   JOIN IN_Main ON IN_Main.InventoryID = i.InventoryID
   JOIN IN_Category1 ON IN_Category1.Category1ID = IN_Main.Catagory1ID
   WHERE IN_Category1.Description = 'XYZ'

   INSERT INTO Magento_Queue(RecID, QueueName, Identifier, QueueInsertionDateTime, LastChangedDateTime, Status, ExceptionText)
   SELECT NewID(), 'Jiwa Inventory', i.PartNo, GETDATE(), GETDATE(), 0, NULL
   FROM @PartNos i
   LEFT JOIN Magento_Queue ON Magento_Queue.Identifier = i.PartNo AND Magento_Queue.QueueName = 'Jiwa Inventory' AND Magento_Queue.Status <> 2
   WHERE Magento_Queue.RecID IS NULL   
GO


In the above trigger, all I added from the standard one is this:

Code: Select all
JOIN IN_Category1 ON IN_Category1.Category1ID = IN_Main.Catagory1ID
   WHERE IN_Category1.Description = 'XYZ'

Re: Magneto Integration

PostPosted: Mon Mar 14, 2016 4:45 pm
by Ahmed
Thank you Mike it worked :)

Ok I will create a new topic for next question.

Thanks