Jump to content

Database info


Claudia M

Recommended Posts

I have setup a few new columns fields whatever they are called) in the inventory table.  Right now they show null if no data is added by my.  Is there a way to just have it blank until I add the info?  Not all products will have all the information. I must have set it up wrong

Thanks in advance,

null.PNG.93b15e45b40916f36468a3edf8cd7896.PNG

Link to comment
Share on other sites

The application is showing null because it was programmed that way. The application code could be rewritten to not show 'null' even if the value of that column in the database table is, in fact, null.

Likewise, one can alter the database table schema so that a column must not hold a null, and must therefore default to a zero-length-string. (Using phpMyAdmin will make this alteration a very easy thing to do.)

Please note there are some conceptual differences between null and a zero-length-string. Perhaps these differences make no difference to your needs.

Link to comment
Share on other sites

Which approach are you wanting to do? Change how nulls get displayed, or change the value that the database table is allowed to hold?

Using phpMyAdmin, have it show the list of columns for the Cubecart_inventory table. For each column you need to change, uncheck the "Allow null" option, and for the default value, choose a string with nothing entered in the text entry field.

The database engine might then automatically change the nulls to a zero-length-string. Or it might not. Or phpMyAdmin may report that altering the columns can't happen as long as there are rows with values that would become disallowed. I'm not sure.

Once the changes to the database is finished, clear the cache, and then those data items ('Start', 'End') will show a zero-length-string.

Link to comment
Share on other sites

This is what I have for redo_start.  It still shows null on the product page even after clearing the caches. I tried the default "as defined" and left the box next to it blank. Still showed null.  I haven't really started populating that field so if I have to setup a new one other that redo_start I can.

 

400657176_datarow.thumb.PNG.f25e75f58f01a893ecfaab37b8715650.PNG

 

image.png

image.png

image.png

Link to comment
Share on other sites

The field is blank.  Maybe on the Product Inventory page it has to show Null for some reason?  Maybe my coding:

<th nowrap="nowrap">{$THEAD.redo_start}</th>

<td><span class="editable number" name="product[{$product.product_id}][redo_start]">{$product.redo_start}</span></td>

        <div><label for="redo_start">Redid / Start Date</label><span><input name="redo_start" id="redo_start" class="textbox number" type="text" value="{$PRODUCT.redo_start}" /></span></div>

 

Link to comment
Share on other sites

For the template you posted part of above, add at the end of that file this:

{debug}

This will have the browser popup a window showing the values of $product and the array that $product came from ($PRODUCTS?).

What is the <div> statement doing? What is $PRODUCT.redo_start?

I think the <div> block is where you are adding/editing data for a specific product. So, we won't worry about that.

 

Link to comment
Share on other sites

So:

Was:
<td><span class="editable number" name="product[{$product.product_id}][redo_start]">{$product.redo_start}</span></td>
Now:
<td><span class="editable number" name="product[{$product.product_id}][begin]">{$product.begin}</span></td>

And the database column name has been changed from 'redo_start' to 'begin'. Or do you assign the query result 'redo_start' to the product array element 'begin' that is given to Smarty?

 

Link to comment
Share on other sites

I created a new column name - begin - with different attributes: as defined, to see if a fresh start would help the null stuff on the product inventory page.  It didn't. Null still shows on that page - null doesn't show on the actual product general information page

Link to comment
Share on other sites

So, regardless of which you use for:

{$product.whatever} in, for example:
<td><span class="editable number" name="product[{$product.product_id}][begin]">{$product.begin}</span></td>

the Smarty diagnostic window says it is a zero-length-string, but what gets displayed is null. That's crazy.

 

Link to comment
Share on other sites

If we're talking about the same thing, the length is VARCHAR 50 and the default is as defined and blank box, per the image above. and it shows Null per the top image above while on the product general information page the input box is blank

BUT if I put a space in the product general information input box then the Product Inventory Start field is blank

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...