I gathered that, and I understand.. However, I still think you can acheive that level of understanding without hacking this mod to achieve it.. JMHO..:smile:
Printable View
Well....So far here is what I have done to Stock By Attributes...
1. Added SKU support. Printing a SKU for each and every varient, as well as printing that SKU to orders. I don't need it available to customers, but I am going to add it in, in the event that someone does need SKU support for customers.
2. 0 Stock. In SBA, you can't just put in 0 under quantity, you have to type 00, or +0 or -0. This is a pain in the ######.
Those are the two things I have changed for SBA...
As for the GRID....
1. Using the EXPLODE function in SBA display to display products in the grid format I need.
2. I have the module displaying and adding the product to the cart. With the attribute hidden fields, and it also checks all stock level by SBA. This works for me since all products with attributes, are controlled by SBA, and all others have standard stock check from the Products database...
I have yet to Get the attributes and price to display correctly. in the shopping cart. At least in the attribute list. The attribute hidden fields are working wonderfully, I should have it worked out this weekend though. I gave up on it for the last few days and took a mini vacation to ease my mind from ripping apart code. I'll make sure I post everything up for the world to see soon. I can send anyone that wants to see my modifications a sample if they want to see, PM me.
Hey Guys,
Has anyone managed to get this working with the file upload box yet?
I'm currently working on a MASSIVE project involving attributes - basically, the customer can pick different attributes for different positions of a garment (ie, a certain logo for the left chest side of a shirt).
Anyway, it's all tied together using Attributes grid. I can't have one without the other really.
I'm going to try and work on a fix regardless and keep you updated if I get anywhere with it :D.
Hello Everyone, i have 2 questions:
1. Does Attributes Grid work with more than 2 attributes? Attributes Grid seems to be exactly what i need, however because a grid is 2 dimensional i assume it only works with products with 2 attributes and once a product has more than 2 attributes it does not work. Is this true? It would be stupendous if i was mistaken here!!!
2. Can anyone confirm whether or not Attributes Grid works with Stock by Attributes Ajax or Stock by Attributes Multiadd? I know it works with Stock by Attributes 4.7 by Kuroi
Update:
I took some code out of includes/classes/shopping_cart.php and modified it.
PHP Code:
$real_ids = isset($_POST['id']) ? $_POST['id'] : "";
if (isset($_GET['number_of_uploads']) && $_GET['number_of_uploads'] > 0) {
include_once(DIR_WS_CLASSES . 'upload.php');
for ($i = 1, $n = $_GET['number_of_uploads']; $i <= $n; $i++) {
if (zen_not_null($_FILES['id']['tmp_name'][TEXT_PREFIX . $_POST[UPLOAD_PREFIX . $i]]) and ($_FILES['id']['tmp_name'][TEXT_PREFIX . $_POST[UPLOAD_PREFIX . $i]] != 'none')) {
$products_options_file = new upload('id');
$products_options_file->set_destination(DIR_FS_UPLOADS);
$products_options_file->set_output_messages('session');
if ($products_options_file->parse(TEXT_PREFIX . $_POST[UPLOAD_PREFIX . $i])) {
$products_image_extension = substr($products_options_file->filename, strrpos($products_options_file->filename, '.'));
if ($_SESSION['customer_id']) {
$db->Execute("insert into " . TABLE_FILES_UPLOADED . " (sesskey, customers_id, files_uploaded_name) values('" . zen_session_id() . "', '" . $_SESSION['customer_id'] . "', '" . zen_db_input($products_options_file->filename) . "')");
} else {
$db->Execute("insert into " . TABLE_FILES_UPLOADED . " (sesskey, files_uploaded_name) values('" . zen_session_id() . "', '" . zen_db_input($products_options_file->filename) . "')");
}
$insert_id = $db->Insert_ID();
$real_ids[TEXT_PREFIX . $_POST[UPLOAD_PREFIX . $i]] = $insert_id . ". " . $products_options_file->filename;
$products_options_file->set_filename("$insert_id" . $products_image_extension);
if (!($products_options_file->save())) {
break;
}
} else {
break;
}
} else { // No file uploaded -- use previous value
$real_ids[TEXT_PREFIX . $_POST[UPLOAD_PREFIX . $i]] = $_POST[TEXT_PREFIX . UPLOAD_PREFIX . $i];
}
}
}
$_POST['attribs'][$prid][$option] = $option_value;
}
}
I placed this after "foreach($_POST['id'] as $option => $option_value) {" in the extra cart actions folder for this module.
Now, this works ok, but it checks every single attribute for an upload, not the upload field in itself, meaning I get a heap of messages saying 'file not uploaded' among 2 or 3 which I did actually upload.
Also, the value doesn't appear on the attributes list below any more either!
I can't work this out!
Can anyone get the problem fixed? Upload not working with grid attribute enabled. Please post a solution if you have one.
Can't wait to see your final solutions..:smile:
Re: the bolded item.. I don't know which version of SBA you have installed, but the 4.7 version written by Kuroi will indeed allow you to zero out your inventory or even delete a product variant with no muss or fuss about it.. You simply enter "0" for the quantity in stock, save and it works perfectly..
For my money the Ver 4.7 of SBA by Kuroi (as opposed to the MultiAdd and Ajax versions) is the only stable SUPPORTED version of SBA available..
The authors of the MultiAdd and Ajax versions unfortunately put their version up and have failed to properly support them. The Ajax version is missing important files it needs to work, and most folks have had to kluge together code to make this version whole.. I have tried both of the "other" versions and have never been able to get either one to work properly.. (plus I see no real benefit of the MultiAdd or Ajax versions)
From following the SBA support thread, the Ajax version and the MultiAdd versions of SBA are the versions people most often have issues with. That said I do use is the stylesheet from the MultiAdd version of SBA.. I like the way it makes a visual distinction between the products and it's variants.. Otherwise the Kuroi version of SBA is stable and works EXACTLY as Kuroi has described it. (no filler added:smile:)
I can't say for sure, but I believe that when the author of this mod says it works with SBA, that he means the Kuroi release of SBA, and not "the others":laugh:.
Thanks to thomasharding's post and some PM his code inserted into the file absolute_products_with_attributes.php in the includes/extra_cart_actions/ folder we now have the uploads working but with a glitch. It doesn't add the attribute to the cart so it would be hard for the owner of the site to know that someone added an upload.
I am reaching out to the devs or anyone else for some help to get this to work.
Here is the code that was used ,
##########BEGIN UPLOAD HACK#############
$real_ids = isset($_POST['id']) ? $_POST['id'] : "";
if (isset($_GET['number_of_uploads']) && $_GET['number_of_uploads'] > 0) {
/**
* Need the upload class for attribute type that allows user uploads.
*
*/
include(DIR_WS_CLASSES . 'upload.php');
for ($i = 1, $n = $_GET['number_of_uploads']; $i <= $n; $i++) {
if (zen_not_null($_FILES['id']['tmp_name'][TEXT_PREFIX . $_POST[UPLOAD_PREFIX . $i]]) and ($_FILES['id']['tmp_name'][TEXT_PREFIX . $_POST[UPLOAD_PREFIX . $i]] != 'none')) {
$products_options_file = new upload('id');
$products_options_file->set_destination(DIR_FS_UPLOADS);
$products_options_file->set_output_messages('session');
if ($products_options_file->parse(TEXT_PREFIX . $_POST[UPLOAD_PREFIX . $i])) {
$products_image_extension = substr($products_options_file->filename, strrpos($products_options_file->filename, '.'));
//Arch 04/2007 - to add product name to uploaded file
$prod_image_name = substr($products_options_file->filename, 0,-4);
//eof
if ($_SESSION['customer_id']) {
$db->Execute("insert into " . TABLE_FILES_UPLOADED . " (sesskey, customers_id, files_uploaded_name) values('" . zen_session_id() . "', '" . $_SESSION['customer_id'] . "', '" . zen_db_input($products_options_file->filename) . "')");
} else {
$db->Execute("insert into " . TABLE_FILES_UPLOADED . " (sesskey, files_uploaded_name) values('" . zen_session_id() . "', '" . zen_db_input($products_options_file->filename) . "')");
}
$insert_id = $db->Insert_ID() . $prod_image_name ;
$real_ids[TEXT_PREFIX . $_POST[UPLOAD_PREFIX . $i]] = $insert_id . ". " . $products_options_file->filename;
$products_options_file->set_filename("$insert_id" . $products_image_extension);
if (!($products_options_file->save())) {
break;
}
} else {
break;
}
} else { // No file uploaded -- use previous value
$real_ids[TEXT_PREFIX . $_POST[UPLOAD_PREFIX . $i]] = $_POST[TEXT_PREFIX . UPLOAD_PREFIX . $i];
}
}
//$this->add_cart($_POST['products_id'], $this->get_quantity(zen_get_uprid($_POST['products_id'], $real_ids))+($new_qty), $real_ids);
}
##########END UPLOAD HACK#############
If someone has any Ideas please let us know, Thanks!