Salus Posted December 11, 2014 Share Posted December 11, 2014 Hi everyone. Ok, this may seem a stupid question to many, but it is unclear to me, so I guess I take my chances and ask: I use prestashop ver.1.5.6. We are at BackPanel ->catalog -> products. Looking to the list of my products. I have a lot of them, around 1350 products. I dont know all of them by name, and even if I do, some other colleagues certainly may not. I wish to update QUANTITIES, but I am not using advanced stock management, instead uploading by .csv . Ok, I can update all the products that have no atttributes by .csv, but what about those, that have lots of attributes? 40% of the products we sell have more than a dozen attributes. No problem, i`m resigned to the fact that I have to upload quantities to these manually (if anyone have a better (free) option doing it bulk please let me know). But... how do I know which products have attributes by looking to this plain list? There is no sign near any product whatsoever that shows if one product has attributes or not. Any thoughts? Please someone offer some assistance over this issue, I am blocked. Thank you. PS: I tried store commander free version, still no go. All I want is a little sign on the backpanel product list that tells me if that product has attributes or not. Link to comment Share on other sites More sharing options...
Salus Posted December 12, 2014 Author Share Posted December 12, 2014 Anybody, please...? Link to comment Share on other sites More sharing options...
NemoPS Posted December 12, 2014 Share Posted December 12, 2014 Real quick solution $this->fields_list['cache_default_attribute'] = array( 'title' => $this->l('Att'), 'filter_key' => 'a.cache_default_attribute', 'align' => 'center', 'class' => 'fixed-width-xs', 'type' => 'int' ); Add this to AdminProductsController.php located in cotnrollers/admin Just right after $this->fields_list['id_product'] = array( 'title' => $this->l('ID'), 'align' => 'center', 'class' => 'fixed-width-xs', 'type' => 'int' ); It's dirty, but it works. Products with a number > 0 there have attributes, the ones with 0 don't 2 Link to comment Share on other sites More sharing options...
Salus Posted December 12, 2014 Author Share Posted December 12, 2014 (edited) Oh yesss, I just LOVE dirty solutions, specially if they work And this indeed does the trick, it added a column to products list labeled ATT, from here I know where to look for attributes. Thank you very much, Nemo1, you just saved my day Hmm, maybe I`m pushing my luck further, but do you happen to know how to upload quantities to products that have attributes? I mean how do I upload products that have multiple attributes, like for example: shoes. There are 11 sizes and 8 colours, and different quantities for each combination - 5 pairs nr 36, white, 2 pairs nr 38 red etc you got the ideea. How do I upload that by csv?f you can tell me that I will definitely have a merry christmas, since this is my not only but the biggest problem at this end of the year.... Thanks again for the solution offered, I think this should be implemented in new version of prestashop (maybe with a constant icon instead of numbers) Edited December 12, 2014 by Salus (see edit history) Link to comment Share on other sites More sharing options...
Salus Posted December 12, 2014 Author Share Posted December 12, 2014 (edited) Feedback: ok, solution is not perfect. I found products wich have attributes, but ATT filter returns value of 0 (null). All the products form the list below have attributes (color) But, walking further this path: there is this code part form product-list.tpl, wich verifies if shoud there be an "add-to-cart" button or not based on the attribute presence. {if ($product.id_product_attribute == 0 || (isset($add_prod_display) && ($add_prod_display == 1))) && $product.available_for_order && !isset($restricted_country_mode) && $product.minimal_quantity <= 1 && $product.customizable != 2 && !$PS_CATALOG_MODE} {if ($product.allow_oosp || $product.quantity > 0)} {if isset($static_token)} <a class="button ajax_add_to_cart_button exclusive" rel="ajax_id_product_{$product.id_product|intval}" href="{$link->getPageLink('cart',false, NULL, "add=1&id_product={$product.id_product|intval}&token={$static_token}", false)|escape:'html'}" title="{l s='Adaugati in cos'}"><span ></span></a> {* {l s='Add to cart'} removed, added: style. ha nem tetszik ezt kell kitorolni*} {else} <a class="button ajax_add_to_cart_button exclusive" rel="ajax_id_product_{$product.id_product|intval}" href="{$link->getPageLink('cart',false, NULL, "add=1&id_product={$product.id_product|intval}", false)|escape:'html'}" title="{l s='Adaugati in cos'}"><span ></span></a> {/if} {else} ...blablabla can the above solution be somehow implemented to the back-panel product list ? Just a thougth... Edited December 12, 2014 by Salus (see edit history) Link to comment Share on other sites More sharing options...
NemoPS Posted December 13, 2014 Share Posted December 13, 2014 Well the point is no attributes are retrieved in the back office list. You need to expand the query but it's a bit complicated. You'd ideally join product_attribute and grab id_product_attribute from there. But it's weird, have those products ever been seen in the front office? The default attribute should be cached usually Link to comment Share on other sites More sharing options...
Salus Posted December 15, 2014 Author Share Posted December 15, 2014 But it's weird, have those products ever been seen in the front office? The default attribute should be cached usually Not sure if those products were ever seen in front office, since we did not launch the site yet, we are building up the database first, then adding starting quantities. But speaking of this, I just realized that updating quantities for products with attributes will be a pain in the ***back unless I quickly find a solution to upload data from csv. I could try doing it directly to the database with phpmyadmin, if I`d knew wich table contains the data for attributes. I think it is not a table but a query done from many tables, but I dunno which ones. Link to comment Share on other sites More sharing options...
Salus Posted December 15, 2014 Author Share Posted December 15, 2014 (edited) Ok, i give up, i can not find a solution to upload data in bulk, so I decided to do something else. I disabled stock management totaly, i wont bother with that anymore until I learn some sql. But still, I would like to be able to show on screen if a product is available or not. I need your help in this. We are at product.tpl. The code below is suited to decide if avilability is shown on product page or not: <p id="availability_statut"{if ($product->quantity <= 0 && !$product->available_later && $allow_oosp) OR ($product->quantity > 0 && !$product->available_now) OR !$product->available_for_order OR $PS_CATALOG_MODE} style="display: none;"{/if}> <span id="availability_label">{l s='Availability:'}</span> <span id="availability_value"{if $product->quantity <= 0} class="warning_inline"{/if}>{if $product->quantity <= 0}{if $allow_oosp}{$product->available_later}{else}{l s='This product is no longer in stock'}{/if}{else}{$product->available_now}{/if}</span> </p> Since ther is no more quantity, i would like to use product ->on_sale to show availability instead of quantity, since on_sale has only two values, 0 and 1. I can upload these values in bulk by csv. Question is: how to modify the above code so it will display availability based on on_sale value, REGARDLESS of the attributes? I want this to take its value only from ps_product, not ps_product_attribute or whatever table is using. All I want is to add a two value swich wich will display on screen one of the two values: in stock or available for order. Please someone help me do this before christmas. Thank you PS: i did the following: <p id="availability_statut"> <span id="availability_label">{l s='Availability:'}</span> <span id="availability_value"{if $product->on_sale <= 0} class="warning_inline"{/if}>{if $product->on_sale <= 0}{if $allow_oosp}{$product->available_later}{else}{l s='This product is no longer in stock'}{/if}{else}{$product->available_now}{/if}</span> </p> It works fine with products that have no attributes, but does not with products with attributes. WHY? PPS: i started a new topic in development for this issue since it is not the original problem anymore. http://www.prestashop.com/forums/topic/388174-how-to-use-a-truefalse-value-for-showing-product-availability-on-screen/ Edited December 15, 2014 by Salus (see edit history) Link to comment Share on other sites More sharing options...
Salus Posted December 18, 2014 Author Share Posted December 18, 2014 still looking for an answer on this one, UP Link to comment Share on other sites More sharing options...
NemoPS Posted December 19, 2014 Share Posted December 19, 2014 hm, wait, I'm getting confused. If you only want it to be based off the on_sale value, it should work with combos too, like {if $product.on_sale} available{else}unavailable{/if} You say this doesn't work with products having combos? Link to comment Share on other sites More sharing options...
Salus Posted December 19, 2014 Author Share Posted December 19, 2014 You say this doesn't work with products having combos? Yes, at least this is what happened to me. If product has combos, then the listing is not made form ps_product anymore, but from a complicated query between ps_product and ps_product_attributes and god knows what else, so the on_sale value is not being taken into account (because it is not part of the default query). Sigh, i think this is pretty blurry said... Link to comment Share on other sites More sharing options...
BarryH Posted December 20, 2014 Share Posted December 20, 2014 Feedback: ok, I found products wich have attributes, but ATT filter returns value of 0 (null). For what it's worth, I saw similar results after implementing the patch above. What I discovered was that the products that returned "Null" had been recently imported from Store Manager and had not been edited yet. Once I edited one of the newly imported products in any fashion, the Null was replaced by a number (0 or non-0). Link to comment Share on other sites More sharing options...
Salus Posted December 22, 2014 Author Share Posted December 22, 2014 For what it's worth, I saw similar results after implementing the patch above. What I discovered was that the products that returned "Null" had been recently imported from Store Manager and had not been edited yet. Once I edited one of the newly imported products in any fashion, the Null was replaced by a number (0 or non-0). Yes, very likely because above solution is takent it`s values from cache. Since I already build up my database and have edited 98% of the products, there is no way i can do (and I wont do) that again manually. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now