Re: Stock by Attribute v4.0 for Zen Cart 1.3.5
Quote:
Originally Posted by
Kevin205
In my version of SBA; deleting a product from catalogue does NOT delete the records belonging to that product in the SBA table. Is there a preferred method of cleaning up / deleting product attribute from SBA table?
That functionality has not yet been ported into the version of SBA for Zc 1.5.1. Which is the version of ZC identified in your signature as your current version. The functionality however is in the version applicable to ZC 1.5.3 and 1.5.4 available at: https://github.com/potteryhouse/stoc...12345678_ZC154
Remember this is still beta software. The admin/includes/classes/observers/class.products_with_attributes_stock.php file found in that folder contains the actions necessary to accomplish what you are describing (as well as other functions that would require code changes elsewhere in your system or they could be commented out so as not to throw errors.) To use this file the applicable auto_loaders file would also be necessary to kick ZC off to use the above admin class file.
Otherwise, the method I would suggest to remove all attributes applicable to a given product would be to delete all sba table entries for that product using a sql query after backing up the database... Yes, backup the database before deleting...
The expected sql would be:
Code:
delete from products_with_attributes_stock where products_id = '20'
Where 20 would be the product number for the product being deleted... Remember BACKUP before executing.
Re: Stock by Attribute v4.0 for Zen Cart 1.3.5
Quote:
Originally Posted by
mc12345678
That functionality has not yet been ported into the version of SBA for Zc 1.5.1. Which is the version of ZC identified in your signature as your current version. The functionality however is in the version applicable to ZC 1.5.3 and 1.5.4 available at:
https://github.com/potteryhouse/stoc...12345678_ZC154
Remember this is still beta software. The admin/includes/classes/observers/class.products_with_attributes_stock.php file found in that folder contains the actions necessary to accomplish what you are describing (as well as other functions that would require code changes elsewhere in your system or they could be commented out so as not to throw errors.) To use this file the applicable auto_loaders file would also be necessary to kick ZC off to use the above admin class file.
Otherwise, the method I would suggest to remove all attributes applicable to a given product would be to delete all sba table entries for that product using a sql query after backing up the database... Yes, backup the database before deleting...
The expected sql would be:
Code:
delete from products_with_attributes_stock where products_id = '20'
Where 20 would be the product number for the product being deleted... Remember BACKUP before executing.
Got it and thank you mc12345678.
Re: Stock by Attribute v4.0 for Zen Cart 1.3.5
Is it possible to write a query to display the following in one pass?
products_id
products_model
customid
products_attributes_id
options_id
options_values_id
products_options_values_name
I have been trying to get a query to work, but have not been successful.
Re: Stock by Attribute v4.0 for Zen Cart 1.3.5
I got kicked out while typing!
I have this query working, but only for one product id (52). I need to retrieve all data.
PHP Code:
select
p.products_id,
p.products_model,
pa.products_attributes_id,
pa.options_values_id,
pov.products_options_values_name,
sba.customid,
sba.quantity
from
zen_products as p
left join
zen_products_attributes as pa ON p.products_id = pa.products_id
left join
zen_products_with_attributes_stock as sba ON pa.products_attributes_id = sba.stock_attributes
left join
zen_products_options_values as pov ON pa.options_values_id = pov.products_options_values_id
where
p.products_id = 52;
This question might not belong here; but since it performs a query on the SBA table, I thought it could be OK?
Re: Stock by Attribute v4.0 for Zen Cart 1.3.5
Assuming that you use only single option names with each productit seems that if you removed the where clause, that the results for all products would be returned with null I thought in the fields where a product was not tracked by SBA, if wanted to return only sBA tracked product information, then would change from p.products_id to sba.products_id so that results only included sba tracked product.
If however product includes multiple option names (multiple attributes) then unfortunately, the query becomes a bit more complex if even possible with the current data structure of SBA. (Stock_attributes contains combinations of attribute information separated by commas instead of an additional table from which to pull the attributes... This has been one of the issues of SBA in times past and why it has been so difficult to overcome some aspects of SBA.
Ideally though that aspect will be resolved as well as additional capability is added... That said, it also can be worked around in it's current state but requires on occasion additional queries based on the product information.
Re: Stock by Attribute v4.0 for Zen Cart 1.3.5
That did it
Code:
replaced
p.products_id = 52
with
p.products_id = sba.products_id
It accomplished what I needed. It now display all SBA related data, Thank you mc12345678
Re: Stock by Attribute v4.0 for Zen Cart 1.3.5
Quote:
Originally Posted by
Kevin205
That did it
Code:
replaced
p.products_id = 52
with
p.products_id = sba.products_id
It accomplished what I needed. It now display all SBA related data, Thank you mc12345678
Welcome, still could be made easier (assuming no loss of index power) by swapping the first returned value of p.products_id with sba.products_id and omitting the where statement, but it works.
If I may ask, what's the usage of this query? Also as stated, not all data will be provided by that one query if the store has multiple attributes for a product.
Re: Stock by Attribute v4.0 for Zen Cart 1.3.5
Quote:
Originally Posted by
mc12345678
Welcome, still could be made easier (assuming no loss of index power) by swapping the first returned value of p.products_id with sba.products_id and omitting the where statement, but it works.
If I may ask, what's the usage of this query? Also as stated, not all data will be provided by that one query if the store has multiple attributes for a product.
Sorry for the late reply.
While trying to eliminate the discontinued items from the SBA table, I could not find a comprehensive report with all of SBA data needed in one report. That is why I tried to generate the report via SQL.
Re: Stock by Attribute v4.0 for Zen Cart 1.3.5
Can customid data be place in e-mails to clients?
Re: Stock by Attribute v4.0 for Zen Cart 1.3.5
Quote:
Originally Posted by
Kevin205
Can customid data be place in e-mails to clients?
Unfortunately the same answer as before basically applies. Currently supported in the version available from the link above, but not yet ported to version 1.5.3 in support of ZC 1.5.1.