Jump to content
Killersites Forums

grucker

Member
  • Content Count

    97
  • Joined

  • Last visited

Posts posted by grucker

  1. Thanks for the replies, I am still not sure what to do. Is it possible to put an existing site into this framework? Is it easy to enter ones own css sheet and xhtml code? Assuming I go ahead would you all advise which one to use, seriously I need a recommendation.

    Kindest regards

    David

  2. Good morning, I could do with some advice. I have tried to hand code my sites to validate xhtml, css,wai and 508. So far successfully. I meet many snags but with the help and advice of members of forums I keep going. Whenever I have seen a template site it never verifies and uses deprecated terms so it never entered my head to use one. Recently respected forum members on here have admited using them and in some cases actively encouraged the use of them. My questions are these, Why are you using them? What is wrong with hand coding? Would it benefit me to use one of these and which one? Is this the way forward in web design or just a passing fad?

    Kindest regards

    David

  3. Quick comment off the top of my head... In this line:

     

    http://www.ultimateskincare.org.uk/mulberry/images/ul.jpg)no-repeat

     

    what happens in IE if you add a space between the ")" and the "no-repeat" statement? That may fix it.

    It certainly does. So is the rule never a space before a ) but always a space after. I had a problem with an id earlier because of a space. Thanks very much for your help.

    Kindest regards

    David

  4. Good evening, I am trying to insert pictures as buttons. Everything works fine in firefox and Safari but in IE nothing.

    The following is the code.

    .star {

    margin: 0;

    padding: 0;

    }

     

    .star li {

    margin: 0;

    padding: 2px 0 2px 20px;

    list-style: none;

    background: url(http://www.ultimateskincare.org.uk/mulberry/images/ul.jpg)no-repeat left;

    }

    and the following is the list code

    Organic toner refines pores, promotes smooth, clear skin. Alcohol-free and non-drying.

    Balances and gently hydrates all skin types promoting skin radiance and suppleness.

     

    Oil-free formula suitable for use as moisturiser for oily skin and daily treatment for blemishes.

    Calms and soothes inflamed, damaged and aggrevated skin and suitable for all dry, mature skins and dry skin conditions such as eczema.

    Enhances the effectiveness of other products such as moisturisers and serums allowing better absorption.

    Natural opulent fragrance instantly calms the mind creating peace and stillness.

     

     

    Any help?

  5. Hi, in part 4: "Building the catalog page" are all items in one row.

    I can get them in one column if I want but I can't figure out how to get two items(columns)/row.

     

    Can anyone help me, please?

    Best regards

    toastrom

    Go to the topic in the php section dated December 23, 2009 8:07 am, this explains perfectly how to make three columns so altering the 2 to one will show 2 columns.

  6. Hope this helps. I tried the idea suggested by Falcencreative and it works perfectly.

     

    All " in the code should be replaced with ' and includes dont seem to work so you will have to write the full code. the following code was entered in every die which is a pain on a large verified form but it does work. You didnt include you footer code so I cant advise further, maybe if you publish it falcencreative will post the correct code.

     

    {

    die(" You haven't Entered Your First Name. Go back and Enter your First Name


    footer
    ". mysql_error());

    }

  7. I carefully studied your comments and couldnt get any where but I was looking at the

    public function GetShippingCost and I altered it to just echo 5.

    This worked so I messed about and bingo it works perfectly. below is the original code and below that the new code. nothing else to delete.

     

    public function GetShippingCost()

    {

    $total = 0;

    foreach ($this->items as $product_id => $quantity )

    $total = $total + $this->GetItemShippingCost($product_id);

    return $total;

    }

     

    public function GetShippingCost()

    {

    $total = 0;

     

    foreach ($this->items as $product_id => $quantity)

    $total = $total + $this->GetItemCost($product_id);

     

    if ($total < 50)

    return 3.50;

    if ($total > 50)

    return 'Postage Free';

    }

  8. Close, It leaves the postage already entered even though the amount is over 50. If that cannot be solved they will have to live with it. The warnings refer to

    things in both files and I have tried some arbitrary deletions without success.

    Thanks for your attention. I find I am learning just cant always read what I am seeing.

    Thanks

    David

     

    Warning: Missing argument 1 for ShoppingCart::GetShippingCost(), called in E:\domains\s\sites4eyes.co.uk\user\htdocs\Paypalwebstore\htdocs\mulberry\functions\templates.php on line 145 and defined in E:\domains\s\sites4eyes.co.uk\user\htdocs\Paypalwebstore\htdocs\mulberry\classes\ShoppingCart.php on line 37

     

    Notice: Undefined variable: total in E:\domains\s\sites4eyes.co.uk\user\htdocs\Paypalwebstore\htdocs\mulberry\classes\ShoppingCart.php on line 39

    Product ID Quantity Amount

    Chocolate_Body_Butter_60 2 ?25.9

    Rejuvenating_Serum 2 ?45

    Sandalwood_Lemon_Shower_Gel 1 ?6.99

    Postage and Packing ?3.5

    Total: ?77.89

  9. As well as the previous file this function is in the template file. I only want postage added as follows

    Orders under ?50.00 ?3.50 postage

    Orders ?50.00 and over Free postage and packaging.

     

    function render_shopping_cart()

    {

    $shopping_cart = get_shopping_cart();

     

     

    $output = "

    Product ID

    Quantity

    Amount

    ";

    $line_item_counter = 1;

    foreach ($shopping_cart->GetItems() as $product_id)

    {

    $output .= render_shopping_cart_row($shopping_cart , $product_id, $line_item_counter);

    $line_item_counter++;

    }

     

     

    $output .= render_shopping_cart_shipping_row($shopping_cart);

     

    $output .= render_shopping_cart_total_row($shopping_cart);

     

     

    $output .="

    ";

     

    return $output;

    }

    function render_shopping_cart_total_row(ShoppingCart $shopping_cart)

    {

    return "

    Total:

    £".$shopping_cart->GetTotal()."

    ";

     

    }

    function render_shopping_cart_shipping_row(ShoppingCart $shopping_cart)

    {

    return "

    Postage and Packing

    £".$shopping_cart->GetShippingCost()."

    ";

     

    }

    function render_shopping_cart_row(ShoppingCart $shopping_cart , $product_id, $line_item_counter)

    {

    $quantity = $shopping_cart->GetItemQuantity($product_id);

    $amount = $shopping_cart->GetItemCost($product_id);

    $unit_cost = get_item_cost($product_id);

    $shipping_amount = $shopping_cart->GetItemShippingCost($product_id);

     

    return "

    $product_id

    $quantity

    £$amount

    ";

    }

  10. I have attached theshopping cart class file. How do I charge postage based on the number of items purchased rather than the price and how do I add more items from the order page?

    I have had a bash and got some strange results.

    Regards

    David

     

    public function GetShippingCost()

    {

    $total = 0;

    foreach ($this->items as $product_id => $quantity )

    $total = $total + $this->GetItemShippingCost($product_id);

     

    return $total;

    }

    public function GetItemShippingCost($product_id)

    {

    return $this->items[$product_id] * $this->getShippingCostFor(get_item_cost($product_id));

    }

    public function GetSubTotal()

    {

    $total = 0;

     

    foreach ($this->items as $product_id => $quantity)

    $total = $total + $this->GetItemCost($product_id);

     

    return $total;

     

    }

    public function GetTotal()

    {

    // add tax here..

    return $this->GetSubTotal() + $this->GetShippingCost();

    }

    private function getShippingCostFor($total)

    {

    if ($total < 20)

    return 2.50;

     

    elseif ($total < 30)

    return 3.5;

     

     

    else

    return 4.50;

    }

  11. Just to let you know the include thing is no go.

    Found an opposite way to do what I would like, i.e. keep the common code and use variable to insert individual code. This solution is better than I hoped as I only need one function for everything.

    This is the function begining the rest is added

     

    function render_products($area) {

    $output = "

    $i = 0;

    $funcname = "get_xml_" . $area;

    foreach ($funcname() as $product) {

     

    I also altered the call to or whatever page I want so That is the only file I have to change the function stays the same no matter how many pages I produce.

     

    <?= render_products('face');?>

     

    Thanks for all the advice

    Regards

    David

  12. The line

     

    $output .= '

     

    Needs to be the first line within the include.

     

    And you still need to have a closing "}" after the include but before the "return $output" that closes the foreach loop.

     

    I now get

    Parse error: syntax error, unexpected $end in E:\domains\s\sites4eyes.co.uk\user\htdocs\Paypalwebstore\htdocs\mulberry\functions\templates.php on line 726

     

    So I left the} above the $output and pasted the goodsbox in and got the following

     

     

     

    Notice: Undefined variable: output in E:\domains\s\sites4eyes.co.uk\user\htdocs\Paypalwebstore\htdocs\mulberry\functions\templates.php on line 78

     

     

    The } is after the$output on all the other pages I have put it back and the page loads.

    Is there another way of loading the code? The gaffer suggested something but I wasnt sure.

     

    Thanks for your help.

    Regards

    David

  13. I now get

    Parse error: syntax error, unexpected T_STRING in E:\domains\s\sites4eyes.co.uk\user\htdocs\Paypalwebstore\htdocs\mulberry\functions\templates.php on line 27

     

    The template file is this and the goodsbox is the inbetween bitsIf I copy and paste the goodsbox back to the template it works. any other ways?

    Kindest regards

    David

     

    function render_products_from_FACE() {

    // starts the product table

    $output = "

    // sets loop to 0

    $i = 0;

    // starts looping through products

    foreach (get_xml_face() as $product) {

    $output .= '

     

    include("../includes/goodsbox.php");

     

    return $output;

    }

  14. Still struggling.

     

    Latest effort goodsbox.php includes all the rest of my code from the first posting I get the following error

     

    Parse error: syntax error, unexpected $end in E:\domains\s\sites4eyes.co.uk\user\htdocs\Paypalwebstore\htdocs\mulberry\functions\templates.php on line 722

     

    This following code is on lines 4 to 12 Advice please. Regards

     

    <?php

     

    function render_products_from_FACE() {

    // starts the product table

    $output = "

    // sets loop to 0

    $i = 0;

    // starts looping through products

    foreach (get_xml_face() as $product) {

    include("../includes/goodsbox.php");

    }

    ?>

  15. I am not sure what the lady means. I showed all the code which is a function. I am using this function many times. The only differences are the top eight lines so I wanted to just code the top eight lines for the next function and add the rest from another file. I have tried various insert modes with no success.

    Regards

    David

  16. Good morning, Just out of interest, in the following code only the top eight lines are unique. What code would I use to file the common code in another file and insert where necessary. I have tried includes and output but nowt works. As I was advised earlier the code gets very repetitious.

    Thank you David.

     

    >
    
    function render_products_from_FACE() {
       // starts the product table
       $output = "</pre>
    <table>
    
    
    
    
    ' . $product->title . '
    
    
    
     
    
    
    ' . $product->description . '
    
    
    
    
    
    ' . $product->info . ' 
    
    
    
    
    
    ' . $product->size . '        
                          £' . $product->price .'
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    s if there aren't enough products to completely 
       // fill up the table
       if ($i == 1)
           $output .= '</table>';<br><br>   return $output;<br>

  17. relative path

    Thanks , I did the relative path and one link led to another until the page loaded correctly. I did not quite understand the alternative. Would this have saved time and could you put the code in context for me.

    Thank you once again,

    Regards

    David

  18. <?php include("http://www.sites4eyes.co.uk/Paypalwebstore/htdocs/mulberry/includes/header.php"); ?>

     

     

     


    poppy red logoLuxurious Bath & Shower Productspoppy red logo


    <?php

    if (isset($_REQUEST['clear']))

    {

    $shopping_cart->EmptyCart();

     

    }

    set_shopping_cart($shopping_cart);

    ?>

     

     

    <?= render_products_from_XML();?>

     




    poppy red logo Polish, Moisturiser,

    Creams & Balmspoppy red logo


     

    <?= render_products_from_XML_SHORT();?>

     

     

     


    <?php include("http://www.sites4eyes.co.uk/Paypalwebstore/htdocs/mulberry/includes/footer.php"); ?>

     

  19. Good morning, the following link

    is intended to go to a specific product, however it only links to the top of the page. The page source shows

    Is the reason for the failure because the page is loaded from xml and if so is there a way to link to the relevent spot?

    Regards

    David

  20. Must admit I was a bit dispirited but as you said you may be able to help if you saw the code here goes.

    I have two xml files catalog.xml and catalogshort.xml I have added both to the globals.

     

    The files load to my page but I cannot suss out

    function set_shopping_cart($cart) I have tried adding the catalogshort but failed with every attempt. I thought it would be easy but I do not know how.

     

    <?php

    /** Define Globals **/

    define('STORE_XML_SHORT_FILE' , 'catalogshort.xml');

    define('STORE_XML_FILE' , 'catalog.xml');

    define('PAYPAL_BUSINESS', 'dmaxey_1261514279_biz@btinternet.com');

    define('PAYPAL_URL' , 'https://www.sandbox.paypal.com/cgi-bin/webscr');

     

    /** DEFINE REFERENCES **/

    require_once('functions/templates.php');

     

    require_once('classes/ShoppingCart.php');

     

    /** Functions **/

    SESSION_START();

    function get_xml_catalog()

    {

    return new SimpleXMLelement(file_get_contents(STORE_XML_FILE));

    }

    function get_xml_catalogshort()

    {

    return new SimpleXMLelement(file_get_contents(STORE_XML_SHORT_FILE));

    }

    function get_shopping_cart()

    {

    if (! isset($_SESSION['cart']))

    return new ShoppingCart();

    else

    return unserialize($_SESSION['cart']);

     

    }

     

    function set_shopping_cart($cart)

    {

    $_SESSION['cart'] = serialize($cart);

    }

     

    function product_exists($product_id)

    {

    foreach(get_xml_catalog() as $product)

     

    {

    if ($product->id == $product_id)

     

    return true;

    }

    return false;

    }

    function get_item_cost($product_id)

    {

    foreach(get_xml_catalog()as $product)

    {

    if ($product->id == $product_id)

    return $product->price;

    }

    throw new Exception('item not found:'. $product_id);

    }

    ?>

  21. Unfortunately I'm not really familiar enough with this particular tutorial to be able to give you advice on working with multiple XML files.

     

    My guess, however, is that you'd need to look at the code for the "addToCart.php" page, and see what it's doing with the id value that gets passed when you click the "add to cart" button. You probably need to add a reference to the second XML file at some point within that code. (I can't really tell you where unless I see the code you're working with.)

     

    Thanks for looking for me. It seems strange that the author of the course didnt explain how to use multiple xml pages. I thought a page for each type of product would have kept the site more manageable and easier to edit. Seems I have wasted our time.

     

    Thanks ever so much for your help at least I have learnt lots of pointers from you which have given me more of an insight to php.

     

    Kindest regards

    David

  22. Tried again this morning and it appears to be working ok in firefox so maybe I had a cache problem.

     

    Now then, I have two xml files with different types of products. How do I code the functions to accept the second file and add it to the cart. I have tried duplicating what I already had but get error messages when I try to open the page of goods for sale. If you look at the link the top eight items work fine the rest are in a different file and do not add to the cart.

    Advice please.

    Kindest regards

    David

×
×
  • Create New...