LemonStand Forum: Error applying validation to sale_price_or_discount column. - LemonStand Forum

Jump to content

Status Resolved    

Page 1 of 1
  • Cannot start a new Issue
  • Closed Issue This issue is locked

Report ID #143: Error applying validation to sale_price_or_discount column.

#1 User is offline  
pmeissner 

  • LemonEvangelist
  • PipPipPipPipPipPipPip
  • Group: Members
  • Posts: 132
  • Joined: 11-January 10
  • LocationElverson, PA

Posted 10 February 2012 - 03:25 AM

I'm pretty sure my code hasn't changed but now I'm getting a error on product list pages. See attached screenshot.

Error applying validation to sale_price_or_discount column. Column type is unknown. Probably this is a calculated column. Please call the "type" method to set the column type.


My code for this partial is:
<ul class="product_list">
<?= open_form() ?>
        
    <? 
      if (isset($paginate) && $paginate)
      {
        $page_index = isset($page_index) ? $page_index-1 : 0;
        $records_per_page = isset($records_per_page) ? $records_per_page : 3;
        $pagination = $products->paginate($page_index, $records_per_page);
      }
      else 
        $pagination = null;
    
      $products = $products instanceof Db_ActiveRecord ? $products->find_all() : $products;
      foreach ($products as $product): 
        $is_discounted = $product->is_discounted();
      ?>
      
      <li class="<? $bundle_test = h($product->category_list->name); if (stripos($bundle_test,'bundle') !== false) { echo("bundle"); } ?>">
      
      	<a href="<?= $product->page_url('/products') ?>" onclick="location.href=this.href; return false">
      	
      	<? if (isset($product_image_size)): ?>
      	
	      	<? if( $product_image_size == 'med'): ?>
	      		
	      	  <? $image_url = $product->image_url(0, 100, 100); if ($image_url): ?>
	        	<div class="image"><img src="<?= $image_url ?>" alt="<?= h($product->name) ?>" /></div><? endif ?>
	        	
	        <? elseif( $product_image_size == 'small'): ?>
	        
	        	<? $image_url = $product->image_url(0, 75, 75); if ($image_url): ?>
	        	<div class="image"><img src="<?= $image_url ?>" alt="<?= h($product->name) ?>" /></div><? endif ?>
	        	     
	        <? elseif( $product_image_size == 'large'): ?>
	        
	        	<? $image_url = $product->image_url(0, 'auto', 300); if ($image_url): ?>
	        	<div class="image"><img src="<?= $image_url ?>" alt="<?= h($product->name) ?>" height="300" /></div><? endif ?>
	        	
	        	<? endif ?>
        
        <? else: ?>
        		
        		<? $image_url = $product->image_url(0, 'auto', 300); if ($image_url): ?>
	        	<div class="image"><img src="<?= $image_url ?>" alt="<?= h($product->name) ?>"/></div><? endif ?>

      	<? endif ?>
        </a>
        <div class="info">
          <h2><a href="<?= $product->page_url('/products') ?>"><?= h($product->name) ?></a></h2>
          <p class="shortDescription"><?= h($product->short_description) ?></p>
          <p class="price">
            <strong class="<?= $is_discounted ? 'old_price' : null ?>"><?= format_currency($product->price()) ?></strong>
            <? if ($is_discounted): ?>
            <br/><strong class="sale_price"><?= format_currency($product->get_discounted_price(1)) ?></strong>
            <? endif ?>
          </p>
        </div><div class="clearfix"></div>
        
        <? if ($product->on_sale || $is_discounted): ?>
          <div class="offer">Offer!</div>
        <? endif ?> 
        
      </li>
    <? endforeach ?>
  </ul>
  
  <? 
    if ($pagination)
      $this->render_partial('pagination', array('pagination'=>$pagination, 'base_url'=>$pagination_base_url));
  ?>
</form>


Attached thumbnail(s)

  • Attached Image: Screen Shot 2012-02-10 at 6.20.52 AM.png



Page 1 of 1  
  • Cannot start a new Issue
  • Closed Issue This issue is locked

Replies (1 - 2)

#2 User is offline  
pmeissner 

  • LemonEvangelist
  • PipPipPipPipPipPipPip
  • Group: Members
  • Posts: 132
  • Joined: 11-January 10
  • LocationElverson, PA

Posted 10 February 2012 - 12:09 PM

Seems to be working now. Not sure what was causing it.

#3 User is offline  
Manca 

  • Developer
  • Group: +Administrators
  • Posts: 252
  • Joined: 02-September 11

Posted 10 February 2012 - 12:34 PM

Updating status to: Resolved

Hi,

Did you update the store just before you started seeing the error? We added a new field to the products table in a recent update (sale_price_or_discount). The sql updates don't run during the update, but on first login. The error was probably the result of the field already being in the code, but not created in the database yet. When you logged in, the field was created and the error went away.
It's always best to log out of LS and back in after updating.

Thank you


Page 1 of 1
  • Cannot start a new Issue
  • Closed Issue This issue is locked

0 User(s) are reading this issue
0 Guests and 0 Anonymous Users