Jump to content
Larry Ullman's Book Forums

Recommended Posts

Hello Larry,

 

I am working in my localhost environment:

XAMPP

PHP version 5.3.5

PHPmyadmin (MySQL) version 5.0.7

 

My webroot directory is:

C:\XAMPP\htdocs\

 

And my base directory for the coffee site is:

C:\XAMPP\htdocs\ECOMMERCE_2

 

I just tried to open localhost/ecommerce_2 so I get only raw content and there no images or css links with this page.

 

 

My Config.inc.php file:

............................................

............................................

define ('BASE_URI', 'includes/');

define ('BASE_URL', 'localhost:8888/ecommerce_2');

define ('MYSQL', BASE_URI . 'mysql.inc.php');

............................................

............................................

 

My default header.html file:

............................................

............................................

<link href="/css/style.css" rel="stylesheet" type="text/css" />

</head>

............................................

............................................

 

<li><a href="/index.php" class="first"><img alt="" src="/images/icon-home.gif" /></a></li>

<li><a href="/cart.php"><img alt="" src="/images/icon-cart.gif" /></a></li>

<li><a href="/contact.php"><img alt="" src="/images/icon-mail.gif" /></a></li>

<li><a href="/sitemap.php"><img alt="" src="/images/icon-map.gif" /></a></li>

</ul>

<div class="logo">

<h1><a href="/index.php">Coffee</a><span>Wouldn't you love a cup right now?</span></h1>

</div>

</div>

<ul class="nav">

<!-- MENU -->

<li><a href="/shop/coffee/">Coffee</a></li>

<li><a href="/shop/goodies/">Goodies</a></li>

<li><a href="/shop/sales/">Sales</a></li>

<li><a href="/wishlist.php">Wish List</a></li>

<li><a href="/cart.php">Cart</a></li>

............................................

............................................

 

And my default .htaccess file:

 

<IfModule mod_rewrite.c>

RewriteEngine on

# For sales:

RewriteRule ^shop/sales/?$ sales.php

# For the primary categories:

RewriteRule ^shop/([A-Za-z\+]+)/?$ shop.php?type=$1

# For specific products:

RewriteRule ^browse/([A-Za-z\+\-]+)/([A-Za-z\+\-]+)/([0-9]+)$ browse.php?type=$1&category=$2&id=$3

# For HTTPS pages:

RewriteCond %{HTTPS} off

RewriteRule ^(checkout\.php|billing\.php|final\.php|admin/(.*))$ https://%{HTTP_HOST}/$1 [R=301,L]

</IfModule>

 

 

Does anyone have any ideas or suggestions and how to solve the problem?

 

Thanks

 

Best Wishes,

Adnan

 

 

 

 

Link to comment
Share on other sites

The reference /something means that 'something' will be found in the root directory. Since your site is in the ecommerce_2 folder, the CSS files are in /ecommerce_2/css, not /css. You'll need to change your links and image references accordingly, too.

  • Upvote 1
Link to comment
Share on other sites

It is really worked. Thanks :)

 

Another i have a little bit of a problem with Mugs page. i clicked "View all Mugs Products" link in Goodies page and got error message. it says:

 

An error occurred in script 'C:\XAMPP\htdocs\ECOMMERCE_2\views\list_products3.html' on line 60:

Undefined index: sale_price

Array

(

[0] => Array

(

[file] => C:\XAMPP\htdocs\ECOMMERCE_2\views\list_products3.html

[line] => 60

[function] => my_error_handler

[args] => Array

(

[0] => 8

[1] => Undefined index: sale_price

[2] => C:\XAMPP\htdocs\ECOMMERCE_2\views\list_products3.html

[3] => 60

[4] => Array

(

[GLOBALS] => Array

*RECURSION*

[_POST] => Array

(

)

[_GET] => Array

(

[type] => goodies

[category] => Mugs

[id] => 3

)

[_COOKIE] => Array

(

[sESSION] => 1aad383428ba414ba30679fc7735f5b8

)

[_FILES] => Array

(

)

[live] =>

[contact_email] => you@example.com

[category] => Mugs

[sp_cat] => 3

[sp_type] => other

[type] => goodies

[page_title] => Goodies to Buy::Mugs

[dbc] => mysqli Object

(

[affected_rows] => 2

[client_info] => mysqlnd 5.0.7-dev - 091210 - $Revision: 304625 $

[client_version] => 50007

[connect_errno] => 0

[connect_error] =>

[errno] => 0

[error] =>

[field_count] => 8

[host_info] => localhost via TCP/IP

[info] =>

[insert_id] => 0

[server_info] => 5.5.8

[server_version] => 50508

[sqlstate] => 00000

[protocol_version] => 10

[thread_id] => 6

[warning_count] => 0

)

[r] => mysqli_result Object

(

[current_field] => 0

[field_count] => 8

[lengths] => Array

(

[0] => 91

[1] => 19

[2] => 2

[3] => 14

[4] => 93

[5] => 44

[6] => 4

[7] => 2

)

[num_rows] => 2

[type] => 0

)

[header] => 1

[row] => Array

(

[g_description] => A selection of lovely mugs for enjoying your coffee, tea, hot cocoa or other hot beverages.

[g_image] => 781426_32573620.jpg

[sku] => O2

[name] => Red Dragon Mug

[description] => An elaborate, painted gold dragon on a red background. With partially detached, fancy handle.

[image] => 847a1a3bef0fb5c2f2299b06dd63669000f5c6c4.jpg

[price] => 7.95

[stock] => 22

)

)

)

)

[1] => Array

(

[file] => C:\XAMPP\htdocs\ECOMMERCE_2\browse.php

[line] => 61

[args] => Array

(

[0] => C:\XAMPP\htdocs\ECOMMERCE_2\views\list_products3.html

)

[function] => include

)

)

 

 

list_products3.html:

 

.............................

// Show each product:

echo '<h3>' . $row['name'] . '</h3>

<div class="img-box">

<p><img alt="' . $row['name'] . '" src="/ecommerce_2/products/' . $row['image'] . '" />' . $row['description'] . '<br />' .

get_price($type, $row['price'], $row['sale_price']) .

'<strong>Availability:</strong> ' . get_stock_status($row['stock']) . '</p>

<p><a href="/ecommerce_2/cart.php?sku=' . $row['sku'] . '&action=add" class="button">Add to Cart</a></p></div>';

 

 

// To allow the user to select a quantity:

// Recommended alteration!

/*echo '<form action="/ecommerce_2/cart.php" method="get"><input type="hidden" name="action" value="add" /><input type="hidden" name="sku" value="' . $row['sku'] . '" />

<h3>' . $row['name'] . '</h3>

<div class="img-box">

<p><img alt="' . $row['name'] . '" src="/ecommerce_2/products/' . $row['image'] . '" />' . $row['description'] . '<br />' .

get_price($type, $row['price'], $row['sale_price']) .

'<strong>Availability:</strong> ' . get_stock_status($row['stock']) . '</p><select name="qty"><option>1</option><option>2</option></select> <input type="submit" value="Add to Cart" class="button" /></div></form>';

*/

} // End of WHILE loop.

?>

...........................

 

 

 

Best Wishes,

Adnan

Link to comment
Share on other sites

 Share

×
×
  • Create New...