Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Pulling content outside of the osc installation


lindsayanng

Recommended Posts

SO yea.. is there a way to pull a cart / cart contents box information onto a non osc page that is on the same server? OR can I display products from the cart on another page?

 

The question basically arose when i installed wordpress for a client and wanted to basically pull info from the osc installation to the blog. I'd like to be able to have the cart box that shows their cart contents remain in the header as well as possibly feeding through the most recent products onto the sidebar of the blog.

 

So again.. the question remains how??

 

I would likely assume that I could possibly include the application_top from the osc isntallation but I am not entirely sure. Anyone have any thoughts, comments, or questions??

 

P.S. I do NOT want to integrate wordpress into the osc installation. i need to have the blog admin separate from the wordpress admin.. hence the separate installations on the same server/ account.. (different directory though)

A great place for newbies to start

Road Map to oscommerce File Structure

DO NOT PM ME FOR HELP. My time is valuable, unless i ask you to PM me, please dont. You will get better help if you post publicly. I am not as good at this as you think anyways!

 

HOWEVER, you can visit my blog (go to my profile to see it) and post a question there, i will find time to get back and answer you

 

Proud Memeber of the CODE BREAKERS CLUB!!

Link to comment
Share on other sites

I'm sorry, but i'm having a hard time understanding how that can particularly help me.

 

basically the problem arises when I start including files. I can include the cart by using

<?php include('../includes/boxes/shopping_cart.php');?>

 

But then I get an error that the function cart_contents does not exist (obviously because the functions are definited in application_top.php

 

So then I required application_top.php at the top of my header file in wordpress like this:

<?php require('../includes/application_top.php');?>

 

This throws errors because now it is looking for the configure files.. So creating a direct link to the configure files by adding ANOTHER require statement yeilds the same error because application_top is calling for the configure file using the other file path

A great place for newbies to start

Road Map to oscommerce File Structure

DO NOT PM ME FOR HELP. My time is valuable, unless i ask you to PM me, please dont. You will get better help if you post publicly. I am not as good at this as you think anyways!

 

HOWEVER, you can visit my blog (go to my profile to see it) and post a question there, i will find time to get back and answer you

 

Proud Memeber of the CODE BREAKERS CLUB!!

Link to comment
Share on other sites

You will need to add the line;

 

chdir('/home/***/public_html/');

 

Then add;

 

require('includes/application_top.php');

 

The way you have it in your post above won't work as it will be looking for the configure.php file in the wrong place as it will be starting from the wordpress directory and not the osC directory. Hence the need for the chdir first. Then after you have the shopping cart loaded you will have to chdir things back to the wordpress directory ... or more errors.

Link to comment
Share on other sites

Hmm ok.. So i was wrong.. I DID find some very useful stuff in there and I have managed to remove ALL of the errors from the page in an effort to get the cart to display on the top page.

 

So here is the only issue.. I seem to be loosing the session when going to the blog page.. you can see here:

 

http://hugmeup.com/product_info.php/

 

now, how do I retain the session id? do i need to use href_tep_ for ALL links??

A great place for newbies to start

Road Map to oscommerce File Structure

DO NOT PM ME FOR HELP. My time is valuable, unless i ask you to PM me, please dont. You will get better help if you post publicly. I am not as good at this as you think anyways!

 

HOWEVER, you can visit my blog (go to my profile to see it) and post a question there, i will find time to get back and answer you

 

Proud Memeber of the CODE BREAKERS CLUB!!

Link to comment
Share on other sites

Fixed the cookie issue.. I can now force cookies which means I do not need to have the stupid session iD in the urls which means I dont need to append all links in the wordpress install

 

NOW i have an issue when i go from the store, add an item to my cart, and the go to the blog.. the function to calculate price is not being passed to the blog

A great place for newbies to start

Road Map to oscommerce File Structure

DO NOT PM ME FOR HELP. My time is valuable, unless i ask you to PM me, please dont. You will get better help if you post publicly. I am not as good at this as you think anyways!

 

HOWEVER, you can visit my blog (go to my profile to see it) and post a question there, i will find time to get back and answer you

 

Proud Memeber of the CODE BREAKERS CLUB!!

Link to comment
Share on other sites

hmm this really isnt making much sense..

 

So in the shopping cart, everything works well. The gift vouchers module works, the currencies and caluculations work.. which means the code must be correct.

 

So on the blog side now, it can not calculate the price because it can not find the definition of the calculate_price function in includes/classes/shopping_cart.php which is strange because the code is right here:

 

 function calculate() {
     global $currencies;
  // Start - CREDIT CLASS Gift Voucher Contribution
     $this->total_virtual = 0;
     // End - CREDIT CLASS Gift Voucher Contribution
     $this->total = 0;
     $this->weight = 0;
     if (!is_array($this->contents)) return 0;

     reset($this->contents);
     while (list($products_id, ) = each($this->contents)) {
       $qty = $this->contents[$products_id]['qty'];

// products price
       $product_query = tep_db_query("select products_id, products_price, products_tax_class_id, products_weight from " . TABLE_PRODUCTS . " where products_id = '" . (int)$products_id . "'");
       if ($product = tep_db_fetch_array($product_query)) {
  // Start - CREDIT CLASS Gift Voucher Contribution
         $no_count = 1;
         $gv_query = tep_db_query("select products_model from " . TABLE_PRODUCTS . " where products_id = '" . (int)$products_id . "'");
         $gv_result = tep_db_fetch_array($gv_query);
         if (ereg('^GIFT', $gv_result['products_model'])) {
          $no_count = 0;
         }
  // End - CREDIT CLASS Gift Voucher Contribution        
         $prid = $product['products_id'];
         $products_tax = tep_get_tax_rate($product['products_tax_class_id']);
         $products_price = $product['products_price'];
         $products_weight = $product['products_weight'];

         $specials_query = tep_db_query("select specials_new_products_price from " . TABLE_SPECIALS . " where products_id = '" . (int)$prid . "' and status = '1'");
         if (tep_db_num_rows ($specials_query)) {
           $specials = tep_db_fetch_array($specials_query);
           $products_price = $specials['specials_new_products_price'];
         }
  // Start - CREDIT CLASS Gift Voucher Contribution
         $this->total_virtual += $currencies->calculate_price($products_price, $products_tax, $qty * $no_count);
         $this->weight_virtual += ($qty * $products_weight) * $no_count;
  // End - CREDIT CLASS Gift Voucher Contribution
         $this->total += $currencies->calculate_price($products_price, $products_tax, $qty);
         $this->weight += ($qty * $products_weight);
       }

 

Any thoughts as to why it can not calculate on the blog side?? is there a page missing that I forgot to include?

A great place for newbies to start

Road Map to oscommerce File Structure

DO NOT PM ME FOR HELP. My time is valuable, unless i ask you to PM me, please dont. You will get better help if you post publicly. I am not as good at this as you think anyways!

 

HOWEVER, you can visit my blog (go to my profile to see it) and post a question there, i will find time to get back and answer you

 

Proud Memeber of the CODE BREAKERS CLUB!!

Link to comment
Share on other sites

Try this change as the in includes\boxes\currencies.php.

 

Change:

 

        $info_box_contents[] = array('form' => tep_draw_form('currencies', tep_href_link(basename($PHP_SELF), '', $request_type, false), 'get'),

 

 

To:

 

        $info_box_contents[] = array('form' => tep_draw_form('currencies', tep_href_link($PHP_SELF, '', $request_type, false), 'get'),

Link to comment
Share on other sites

Thanks for the suggestion java... made those changes and still get the same error

A great place for newbies to start

Road Map to oscommerce File Structure

DO NOT PM ME FOR HELP. My time is valuable, unless i ask you to PM me, please dont. You will get better help if you post publicly. I am not as good at this as you think anyways!

 

HOWEVER, you can visit my blog (go to my profile to see it) and post a question there, i will find time to get back and answer you

 

Proud Memeber of the CODE BREAKERS CLUB!!

Link to comment
Share on other sites

See if the function $currencies is anywhere in the shopping_cart.php file. If it is, make sure it is registered above that part of the file such as in

 

function calculate() {
global $currencies;

 

 

What is line 296 of shopping_cart.php?

Link to comment
Share on other sites

I checked the classes/shopping_cart.php and the only reference to $currencies is in the code I posted above..

 

This starts at line 292

   // Start - CREDIT CLASS Gift Voucher Contribution
         $this->total_virtual += $currencies->calculate_price($products_price, $products_tax, $qty * $no_count);
         $this->weight_virtual += ($qty * $products_weight) * $no_count;
  // End - CREDIT CLASS Gift Voucher Contribution
         $this->total += $currencies->calculate_price($products_price, $products_tax, $qty);
         $this->weight += ($qty * $products_weight);
       }

A great place for newbies to start

Road Map to oscommerce File Structure

DO NOT PM ME FOR HELP. My time is valuable, unless i ask you to PM me, please dont. You will get better help if you post publicly. I am not as good at this as you think anyways!

 

HOWEVER, you can visit my blog (go to my profile to see it) and post a question there, i will find time to get back and answer you

 

Proud Memeber of the CODE BREAKERS CLUB!!

Link to comment
Share on other sites

Try this;

 

   // Start - CREDIT CLASS Gift Voucher Contribution
  $this->total_virtual += tep_add_tax($products_price, $products_tax) * $qty * $no_count;
         $this->weight_virtual += ($qty * $products_weight) * $no_count;
  // End - CREDIT CLASS Gift Voucher Contribution
         $this->total += tep_add_tax($products_price, $products_tax) * $qty;
         $this->weight += ($qty * $products_weight);
       }

Link to comment
Share on other sites

Ohh ok.. no we are getting somewhere.. Making that change now adjusted the error to this:

 

 

Fatal error: Call to a member function calculate_price() on a non-object in /home/hugmeup/public_html/includes/classes/shopping_cart.php on line 307

 

so this starts at 306

            if ($attribute_price['price_prefix'] == '+') {
             $this->total += $currencies->calculate_price($attribute_price['options_values_price'], $products_tax, $qty);
           } else {
             $this->total -= $currencies->calculate_price($attribute_price['options_values_price'], $products_tax, $qty);
           }
         }
       }
     }
   }

A great place for newbies to start

Road Map to oscommerce File Structure

DO NOT PM ME FOR HELP. My time is valuable, unless i ask you to PM me, please dont. You will get better help if you post publicly. I am not as good at this as you think anyways!

 

HOWEVER, you can visit my blog (go to my profile to see it) and post a question there, i will find time to get back and answer you

 

Proud Memeber of the CODE BREAKERS CLUB!!

Link to comment
Share on other sites

            if ($attribute_price['price_prefix'] == '+') {
             $this->total += $qty * tep_add_tax($attribute_price['options_values_price'], $products_tax);
           } else {
             $this->total -= $qty * tep_add_tax($attribute_price['options_values_price'], $products_tax);
           }
         }
       }
     }
   }

Link to comment
Share on other sites

I tried to use my powers of deduction to turn this

            if ($attribute_price['price_prefix'] == '+') {
             $this->total += $currencies->calculate_price($attribute_price['options_values_price'], $products_tax, $qty);
           } else {
             $this->total -= $currencies->calculate_price($attribute_price['options_values_price'], $products_tax, $qty);
           }
         }
       }
     }
   }

 

into this:

            if ($attribute_price['price_prefix'] == '+') {
             $this->total += tep_add_tax($attribute_price['options_values_price'], $products_tax, $qty);
           } else {
             $this->total += tep_add_tax($attribute_price['options_values_price'], $products_tax, $qty);
           }
         }
       }
     }
   }

 

Which now removes the error but leaves the cart with just a 0 on the blog side but NOT on the catalog side.. on the catalog side, things look normal

A great place for newbies to start

Road Map to oscommerce File Structure

DO NOT PM ME FOR HELP. My time is valuable, unless i ask you to PM me, please dont. You will get better help if you post publicly. I am not as good at this as you think anyways!

 

HOWEVER, you can visit my blog (go to my profile to see it) and post a question there, i will find time to get back and answer you

 

Proud Memeber of the CODE BREAKERS CLUB!!

Link to comment
Share on other sites

This change

            if ($attribute_price['price_prefix'] == '+') {
             $this->total += $qty * tep_add_tax($attribute_price['options_values_price'], $products_tax);
           } else {
             $this->total -= $qty * tep_add_tax($attribute_price['options_values_price'], $products_tax);
           }
         }
       }
     }
   }

 

Makign this change (your code suggestion) leaves me with just a 0 in place of the cart.. no "item 0" just plain 0

A great place for newbies to start

Road Map to oscommerce File Structure

DO NOT PM ME FOR HELP. My time is valuable, unless i ask you to PM me, please dont. You will get better help if you post publicly. I am not as good at this as you think anyways!

 

HOWEVER, you can visit my blog (go to my profile to see it) and post a question there, i will find time to get back and answer you

 

Proud Memeber of the CODE BREAKERS CLUB!!

Link to comment
Share on other sites

I tried to do some deep searching in the osc forums and I can not seem to figure out what is going wrong here..

 

I basically have the same problem. There is no error, but if i start on the cart, add an item, and then go to the blog, the cart embedded on the blog page shows just a 0.. NOT 0 items.. Then if i click refresh, the 0 items comes back to the cart. You can test yourself here (My link)

 

the blog link on the nav works, so you can click that to get to the blog..

A great place for newbies to start

Road Map to oscommerce File Structure

DO NOT PM ME FOR HELP. My time is valuable, unless i ask you to PM me, please dont. You will get better help if you post publicly. I am not as good at this as you think anyways!

 

HOWEVER, you can visit my blog (go to my profile to see it) and post a question there, i will find time to get back and answer you

 

Proud Memeber of the CODE BREAKERS CLUB!!

Link to comment
Share on other sites

I am now pulling apart and having a look at this tutorial.. its made to look at the osc database to pull products.. if i can focus on it and take a close look, i MIGHT be able to pull the cart info.. MAYBE

 

My link

A great place for newbies to start

Road Map to oscommerce File Structure

DO NOT PM ME FOR HELP. My time is valuable, unless i ask you to PM me, please dont. You will get better help if you post publicly. I am not as good at this as you think anyways!

 

HOWEVER, you can visit my blog (go to my profile to see it) and post a question there, i will find time to get back and answer you

 

Proud Memeber of the CODE BREAKERS CLUB!!

Link to comment
Share on other sites

hmm seems that this topic died quickly.. has no one ever done this?

A great place for newbies to start

Road Map to oscommerce File Structure

DO NOT PM ME FOR HELP. My time is valuable, unless i ask you to PM me, please dont. You will get better help if you post publicly. I am not as good at this as you think anyways!

 

HOWEVER, you can visit my blog (go to my profile to see it) and post a question there, i will find time to get back and answer you

 

Proud Memeber of the CODE BREAKERS CLUB!!

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...