Answer the question
In order to leave comments, you need to log in
How to fix the cart on Wordpress?
Hi all! There is a problem on the site adc.e-dev.pp.ua it is made on Wordpress and there is a Rent button. When you click on the button, we get into the basket prntscr.com/k70zh3 everything seems to be ok. I sent it from the catalog to the tag
<form action="<?php echo site_url() ?>/cart" method="post">
<?php
session_start();
$_SESSION['count'] = $count;
$_SESSION['timedata'] = $timedata;
$_SESSION['title'] = $title;
$_SESSION['price'] = get_field('price', $post_id);
$_SESSION['thumb'] = $thumb;
$_SESSION['post_id'] = $post_id;
?>
<input type="hidden" name="post_id" value="<?php the_ID(); ?>">
<input type="hidden" name="title" value="<? the_title($post_id); ?>">
<input type="hidden" name="price" value="<?php the_field('price', $post_id); ?>">
<input type="hidden" name="thumb" value="<?php
$thumb_id = get_post_thumbnail_id();
$thumb_url = wp_get_attachment_image_src($thumb_id,'full', true);
echo $thumb_url[0];
?>">
****
</form>
echo $_POST['title'];
Answer the question
In order to leave comments, you need to log in
You need to have an array, like items, which will already have titles, etc. for example
[
['id'=>'someid', 'title' => 'someTitle', ....],
['id'=>'someid2', 'title' => 'someTitle2', ....],
['id'=>'someid3', 'title' => 'someTitle3', ....],
]
$items = $_SESSION['items'];
echo 'количество: '. count($items);
foreach($items as $one){
echo $one['title'];
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question