Jump to content

disco_ii_disco

Member
  • Posts

    115
  • Joined

  • Last visited

Posts posted by disco_ii_disco

  1. Hi all,

     

    Just in the process of developing my new Cubecart 5 store.

     

    In my old v4 store I order category products, showing those that are in stock first. The "in stock products" are then sorted by popularity.

     

    I am attempting to do this in v5.

     

    I have the following query in the getCategoryProducts function (clas/catalogue.class.php):

    $newQuery = 'SELECT `I`.`product_id`,
             `I`.`stock_level` 
          FROM `CubeCart_inventory` AS `I`
            INNER JOIN `CubeCart_category_index` AS `C` 
                ON (`I`.`product_id` = `C`.`product_id`)
            INNER JOIN `CubeCart_category` AS `CAT`
                ON (`C`.`cat_id` = `CAT`.`cat_id`)
          WHERE  
           `I`.`status` =1 
        	 AND (`C`.`cat_id` ='.$category_id.'
        	 OR `CAT`.`cat_parent_id` ='.$category_id.')
          GROUP BY `I`.`product_id` ORDER BY `I`.`stock_level`=0,`I`.`popularity` DESC';
    

    This gets the products sorted correctly - in mysql - but they are then being "resorted" by Cubecart.

     

    I am struggling to find where to override CubeCart's sorting function to leave this order intact!

     

    I have tried removing numerous lines from getProductData() and getCategoryProducts() but no joy so far.

     

    Any help would be appreciated.

     

    Regards,

    Chris

     

     

     

     

     

  2. Sorry, still on this subject, does anyone know if (or how) you can include html in the setNotify message?

     

    Everytime I include html in the code snippet it get's stripped back out.

     

    e.g. (this is want I would like):

    {php}
    
    if (isset($_POST['buyproduct'])){
      	
    $GLOBALS['smarty']->assign('ADDED', "Product added to <a href='basket'>basket <span class='glyphicon glyphicon-cart'></span></a>");
    
    }
    {/php}
    
  3. Thank you. I just added this snippet (with the trigger: class.cart.add.preredirect):

    {php}
    
    $message ="Product added to your basket.";
    
    $GLOBALS['gui']->setNotify($message);
    
    {/php}
    

    All works and means no modifcation of the Cubecart code either, which is good.

     

    Another job ticked off my list. Lots to go though!

  4. Cheers Bsmither for the clarification.

     

    The skin is a custom one I am building for my own shop. In my old store, the add to basket message appeared at the top of the central column (when a product is added to basket on the product or category pages).

     

    In my new store - built on Bootstrap - I will either have a pop-up modal box (like ModsIndex has done) or a dismissable alert across the top of the page.

     

    Had a quick play around tonight and got it to work instantly!

    1. I commented out the redirect parts of the add() function in cart.class.php - approx. lines 421, 423, 428 and 431.
    2. I gave the buy button on the content.product.php template the name "buyproduct"
    3. I created this small code snippet (with class.cubecart.display_product as the trigger): 
    {php}
    
    if (isset($_POST['buyproduct'])){
      	
    $GLOBALS['smarty']->assign('ADDED', "Product added to basket");
    
    }
    {/php}
    

    4. Then in product template:

    {if isset($ADDED)}
        <p>{$ADDED}</p>
      {/if}
    //will improve on this once working!
    

    Do you see any issues with removing the re-directs? Everything appears to work from my end!

     

    Cheers,

     

    Chris

  5. Hi all,

     

    Just upgrading from Cubecart 4 to Cubecart 5.

     

    On my old store I have an added to basket message which displays when "added=1" is present in the url e.g. product/jockey-wheel-clamp-34mm/4599?added=1

     

    My old code was:

    if (isset($_GET['added'])) {
     $view_prod->assign("TXT_ADDED_TO_BASKET", "<div class='txtAdded'><h3>Thank you for adding the ".validHTML($prodArray[0]['name'])." to your <a href='/index.php?_g=co&_a=cart'>basket</a>.</h3></div>");
    }
    

    My new code is:

    {php}
      	
    $GLOBALS['smarty']->assign('ADDED', "Product added to basket");
    
    {/php}
    

    Which trigger should I use to action the new version of this code?

     

    I have tried class.cart.add.save, class.cart.add.update and others to no avail so far.

     

    Any help would be greatly appreciated.

     

    Chris,

  6. Hi bsmither,

     

    Your advice pointed me in the right direction.

     

    The php error message related to a different code snippet (which I had deleted from admin but was still in the includes/extra folder).

     

    Once I realised there was no error caused by the snippet I looked more closely at the output code and realised I had typed it in to a section which is only visible if the category has no image!

     

    Three hours wasted but another few CubeCart 5 lessons learned!

     

    Regards,

    Chris

  7. Hi all,

     

    I have created a simple mysql table (related_articles) and a simple code snippet (code below) which has the display_category trigger:

    {php}
    
    if ($related_articles = $GLOBALS['db']->query('SELECT `id` AS articleId, `description` AS articleDescription, `url` AS articleUrl, `type` AS articleType  FROM `related_articles` WHERE `type` = "cat" AND item_id = '.$category['cat_id'].' ORDER BY `id` DESC')) {
    	
      foreach ($related_articles as $related_article) {
    		$related_article_vars[]	= $related_article;
    	}
      	
    $GLOBALS['smarty']->assign('RELATED_ARTICLES', $related_article_vars);
    
    }
    
    {/php}
    

    However, I am getting this error message in my logs:

    PHP Fatal error: Call to a member function assign() on a non-object in /includes/extra/snippet_1679091c5a880faf6fb5e6087eb1b2dc.php on line 15
    

    It appears the $GLOBALS['smarty']->assign() is not working as it should. All the sql is fine.

     

    I have been battling with this for a few hours now so hopefully someone can point out an obvious error!

     

    Kind regards,

     

    Chris

     

     

  8. Since upgrading to CubeCart 4 I have had several customers who have said they have been unable to place an order.

    I have not been able to replicate their problem.

    I know there is a bug which makes ordering a product from search results not possible - has this been reported/fixed in versions after 4.1?

    Chris.

  9. I had an idea to search just the title and keywords of each product (i.e not the description). Ihave been through and added keywords to every product.

    I am struggling for a way to implement this though.

    Any advice - anyone??

    Cheers,

    Chris

  10. Hi,

    You've taken that picture off the homepage. Forgot to say I've only protected images on product pages.

    There are still lots of ways to copy the images but they take a lot longer than a simple right-click or drag to the tab bar.

    Cheers,

    Chris

  11. Just cracked it!

    I'm using KitaBlue skin and replaced line 14 in styleTemplates/content/viewProd.tpl with:

    <div style="background-image: url({IMG_SRC}); background-repeat: no-repeat; background-position: center; width:300px; height:300px; vertical-align:middle; margin:0 auto;"><img src="images/general/px.gif" alt="{TXT_PRODTITLE}" width="300px" height="300px" title="{TXT_PRODTITLE}"></div>

    See it in action on my website: Caravan Accessory Shop

    If someone really wants to steal an image they will but this makes it a little harder for someone to go and take every image.

  12. The billing address codes are the same the delivery address ones but without "_d" at the end.

    For example:

    $result[0]['name_d']

    becomes...

    $result[0]['name']

    Just copy everything inside <div class="deliveryAddress">

    Find and replace the "_d"s and you'll be sorted.

  13. I'm with you on this.

    The search is pretty useless.

    On my website:

    A search for "propane regulator" does not result in a propane regulator being top of the list!

    A search for "inner tent" results in several other products - many not containing the word "inner" - above an actual inner tent!

    I have desperately tried to edit the way the search works but am having no luck at all.

  14. I am trying to protect images on my website as I have spent a lot of time taking them and editing them.

    I know that if they are on the web you can't prevent them being copied but you can make it a little harder for people to do so.

    I disabled right-clicking for a while but I find sites that do that very annoying - and with a bit of know-how it doesn't take long to get round it.

    I've seen sites that put a transparent gif over each image - that is what I'm trying to incorporate but don't know really where to start.

    Can anyone help?

    Cheers,

    Chris

  15. Hi,

    I managed to fix this by adding:

    "COMMENTS" => $this->orderSum['comments'],

    in to the classes/cart/order.php file - after:

    $macroArray = array(

    on line 260.

    Then I added:

    {COMMENTS}

    around line 39 in langauge/en/email.inc.php - after:

    'order_breakdown_1' => "Dear {RECIP_NAME},

    Thank you for your order no: {ORDER_ID} placed on {ORDER_DATE} at: {STORE_URL}.

    I also added the date that the order was shipped in the same way.

    Cheers,

    Chris

×
×
  • Create New...