jak wrote:we have multiple to products published in jiwa, but we only selected products to be published on website, as they are not ready for selling yet,
so how to export only selected products in magento using magento integration plugin in jiwa,
Hi jak/Akash,
We queue products that have changed or have been created using an SQL Trigger - you could modify that to exclude items based on your criteria. Typically people want to exclude items where the "Web Enabled" flag is OFF.
The standard trigger looks like this:
- Code: Select all
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
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
If you change the line which reads
- Code: Select all
INSERT INTO @PartNos SELECT DISTINCT IN_Main.PartNo FROM inserted i JOIN IN_Main ON IN_Main.InventoryID = i.InventoryID
To this:
- Code: Select all
INSERT INTO @PartNos SELECT DISTINCT IN_Main.PartNo FROM inserted i JOIN IN_Main ON IN_Main.InventoryID = i.InventoryID WHERE IN_Main.WebEnabled = 1
Then items Web Enabled will no longer be queued.
An alternative to this is to not do the above, but use the Inventory Item status of the product instead. By default the Magento Integration plugin sets the store item's status (enabled or disabled) based on the inventory item status. In the CreateOrUpdateMagentoProductsFromJiwa method of the plugin, you'll find this piece of code:
- Code: Select all
if (inventory.Status == JiwaFinancials.Jiwa.JiwaInventory.Inventory.InventoryStatuses.e_InventoryStatusActive || inventory.Status == JiwaFinancials.Jiwa.JiwaInventory.Inventory.InventoryStatuses.e_InventoryStatusSlow)
{
productData.status = "1"; // 1 = Enabled
}
else
{
productData.status = "0"; // 0 = disabled
}
You could also modify the above to make the product in the store disabled if WebEnabled was false also, so the product won't appear for shoppers, but it will be pushed up there, and when they do want to publish it, just turn on "Web Enabled" on the item in Jiwa.
Mike