Jump to content

divinedesigns1

Members
  • Posts

    1,200
  • Joined

  • Last visited

Posts posted by divinedesigns1

  1. On 2/7/2019 at 8:11 PM, justsomeguy said:

    Ajax is using Javascript to send a request to the server.  So you send whatever data you need to send to the server, the server gets the data and does whatever you want to do there, and you send any data you might want back to Javascript.

    thanks, sorry for the late reply

  2. 6 hours ago, justsomeguy said:

    One of them runs in the browser and one of them runs on the server, so no.  What you can do is create an ajax request in Javascript and send it to the server with whatever data you want to send to tell the server what to do, and the server sends the response back.

    so use the ajax to get the information from the php to then call the ajax in javascript? if i understand correctly, thanks

  3. how can i link a function to a php form so it can run the function on submit

     

    i know you have to add the function in the action="" but is there anything i need add to make this work correctly?

  4. hey guys how can i not display the whole like to my include file if its in my admin folder?

    include "admin/asset/functions.php";  <---- how it is being included at the moment

    i would like the admin part to not be added, is there a way of doing this?

  5. does anyone have any idea why magento wouldnt display the new theme once you create it? im using 2.2.1

     

    i followed all the steps and nada, if need more information lemme know and ill post the files

     

    fyi: no error displayed

  6. On 10/23/2017 at 8:08 AM, dsonesuk said:

    You should also consider a sort order column, which help sort the parent and sub-menus of each parent with sub-menus.

    I got it working, I also try a similar outcome between a status and its comment and both seem to render find 😄 thanks for the help

  7. 41 minutes ago, dsonesuk said:

    The way i did it was to have all menus in single database table, there would be auto increment id for each and every menu, also there would be another column to hold parent menu id, which could hold many identical id ref to the single auto incremental id that refers to parent, if a menu had no sub-menus it would be given a value of zero.

    The loop would go through all menu id, if parent link equals 0 display single parent menu, move to next, if other than zero stop and with nested loop gather all records (submenus) whose parent menu id's equals current parent menu unique id from outer loop.

    this sound way better than what i just did, now i just have to adjust my database to make this work, thank a lot dsonesuk

  8. so i been messing around with php to find a way to generate menus using php *im bored, so yeah better do something*

    anyway i decided to do it this way

    function menu() {
        include "config.php";
        $mainMenu = mysqli_query($con, "SELECT * FROM `main-menu`") or die('Error: ' . mysqli_error($con));
        if($mainMenu){
            ?>
                <ul>
            <?php
            while($mainRow = mysqli_fetch_assoc($mainMenu)){
                $menuId = $mainRow['id'];
                $commonName = $mainRow['actualName'];
                $menuName = $mainRow['name'];
                $menuTags = '<li><a href="' . $menuName . '">' . $commonName;
                echo $menuTags;
            }
            // check if there's any submenus
            $subMenu = mysqli_query($con, "SELECT * FROM `sub-menu` WHERE `sub-id`=$menuId") or die('Error: ' . mysqli_error($con));
            if($subMenu){
                while($subRow = mysqli_fetch_assoc($subMenu)){
                    $subId = $subRow['sub-id'];
                    $subName = $subRow['sub-name'];
                    $subConame = $subRow['actualNames'];
                    $subMain = $subRow['main-menu-id'];
                    $actualMenu = '<ul>';
                    $actualMenu .= '<li><a href="' . $subName . '">' . $subConame . '</li>';
                    $actualMenu .= '</ul></li>';
                    echo $actualMenu;
                }
            }
        }
        ?>
            </ul>
        <?php
    }
    ?>

    i was wonder if there is another way of doing this, because im only getting one of the sub menu instead of both of them

    so currently the menu looks like this 

    • Home
    • Services
      • Service 1

    it suppose to look like this instead

    • Home
    • Services
      • Service 1
      • Service 2

    any idea of what im doing wrong? as always your response is appreciated greatly

  9. hey guys, is there a way to style my background image in css to be used on a wordpress website? i try to do this but the background isnt being shown at all once i upload both folder and file

     

     

    if anyone can help with this, it would be greatly appreciated

  10.  

    Well, it does look correct. It's pretty good.

     

    You probably should remove the swear words from content you're posting on the forums.

     

    You wouldn't need all the !important rules if your CSS was put after all the other stylesheets. On a website always put external libraries first and your own custom code after, so that your custom code takes precedence.

     

    These don't have to be buttons, they would be better off as links.

    <button id="learnhtml">LEARN HTML</button>
    <button id="htmlreference">HTML REFERENCE</button>
    

    thanks to your advice i just fixed one of my issues, i appreciate it

  11. ok, so i created a website for a friend and he send me a email stating that theres errors on the website, so i check it out today and there were errors, so i went and pick up my kid came back log into his websites and there's no errors.

     

    is it possible for websites to give random errors and fixed itself?

  12. If they have different prices then you need to create different entries in the cart for each product/price, or otherwise split them up somehow so that you know how many of each at what price.

    thanks

  13. hey, ok im trying to add the used price of an item within the cart that holds the original price. so i created a duplicated of the original price script so i can add the used price

    if (isset($_POST['pid'])) {
        $pid = $_POST['pid'];
    	$wasFound = false;
    	$i = 0;
    	// If the cart session variable is not set or cart array is empty
    	if (!isset($_SESSION["cart_array"]) || count($_SESSION["cart_array"]) < 1) {
    	    // RUN IF THE CART IS EMPTY OR NOT SET
    		$_SESSION["cart_array"] = array(0 => array("item_id" => $pid, "quantity" => 1));
            
            setcookie('id', $pid, time() + (86400 * 7));
            setcookie('quantity', '1', time() + (86400 * 7));
    	} else {
    		// RUN IF THE CART HAS AT LEAST ONE ITEM IN IT
    		foreach ($_SESSION["cart_array"] as $each_item) {
    		      $i++;
    		      while (list($key, $value) = each($each_item)) {
    				  if ($key == "item_id" && $value == $pid) {
    					  // That item is in cart already so let's adjust its quantity using array_splice()
    					  array_splice($_SESSION["cart_array"], $i-1, 1, array(array("item_id" => $pid, "quantity" => $each_item['quantity'] + 1)));
                            setcookie('id', $pid, time() + (86400 * 7));
                            setcookie('quantity', $each_item['quantity'], time() + (86400 * 7));
    					  $wasFound = true;
    				  } // close if condition
    		      } // close while loop
    	       } // close foreach loop
    		   if ($wasFound == false) {
    			   array_push($_SESSION["cart_array"], array("item_id" => $pid, "quantity" => 1));
                   setcookie('id', $pid, time() + (86400 * 7));
                   setcookie('quantity', $each_item['quantity'], time() + (86400 * 7));
    		   }
    	}
    	header("location: confirm.php");
        exit();
    }
    

    and this is the script for the used price

    if(isset($_POST['uid'])){
        $use = $_POST['uid'];
        $use_product = $_POST['used'];
        $i = 0;
        $wasFound = false;
        if(!isset($_SESSION['cart_array']) || count($_SESSION['cart_array']) < 1){
            $_SESSION['cart_array'] = array(0 => array("item_id" => $use, "quantity" => 1, "price" => $use_product));
            header("location: confirm.php");
        }else{
            foreach($_SESSION['cart_array'] as $each_item){
                $i++;
                while(list($key, $value) = each($each_item)){
                    if($key == "item_id" && $value == $use){
                        // that item is in the cart already adject quantity
                        array_splice($_SESSION["cart_array"], $i-1, 1, array(array("item_id" => $use, "quantity" => $each_item["quantity"] + 1, "price" => $use_product)));
                        $wasFound = true;
                        header("location: confirm.php");
                    }
                }
            }
            // if no item is in the cart
            if($wasFound == false){
                array_push($_SESSION['cart_array'], array("item_id" => $use, "quantity" => 1));
                header("location: confirm.php");
            }
        }
    }
    

    I probably dont need both of these script right? and how can i excuted these prices so both can be added to the cart and not just add the same price

     

    so pretty much original price is 20 and the used price is 10 but i keep on getting the total of 40 instead of 30

     

    help please, no scripts please :)

×
×
  • Create New...