- This topic has 3 replies, 3 voices, and was last updated 4 years, 10 months ago by
oferli.
-
AuthorPosts
-
-
March 31, 2017 at 2:06 am #7873
oferliParticipantAfter few weeks that the back-end was working fine tonight, while the user edit the page back-end and save, all the data beside the 1’st element had been disappear. Sure enough the data are fine in the front-end
this is my meta-box file
<?php
/*
Title: Sections
Post Type: page
Template: catalog
priority: high
order: 20
*/function pl_color() {
global $lo_options;$colors = maybe_unserialize($lo_options[‘colors’]);
$ret[‘none’] = ‘Choose Color’;
foreach ($colors as $color) {
$ret[$color[‘name’]] = $color[‘name’];
}
return $ret;
}function pl_products () {
$posts = get_posts(array(
‘order’ => ‘ASC’,
‘orderby’ => ‘title’,
‘meta_key’ => ‘product ID’,
‘post_type’ => ‘page’,
‘post_status’ => ‘publish’,
‘posts_per_page’ => -1,
‘meta_query’ => array(
‘relation’ => ‘OR’,
array(‘key’ => ‘product ID’, ‘compare’ => ‘EXISTS’, ),
array(‘key’ => ‘img_dir’, ‘compare’ => ‘EXISTS’, )
)));
$ret[‘none’] = ‘Choose product’;
foreach ($posts as $p) {
$ret[$p->ID] = $p->post_title;
}
return $ret;
}$products = pl_products();
$color = pl_color ();piklist(‘field’, array(
‘type’ => ‘group’
,’field’ => ‘section’
,’label’ => ‘Section’
,’add_more’ => true
,’fields’ => array(
array(
‘type’ => ‘text’
,’field’ => ‘name’
,’label’ => ‘Section title’
,’columns’ => 6
)
,array(
‘type’ => ‘textarea’
,’field’ => ‘mobile’
,’label’ => ‘Mobile description’
,’columns’ => 6
)
,array(
‘type’ => ‘group’
,’label’ => ‘Product’
,’field’ => ‘products’
,’template’ => ‘field’
,’add_more’ => true
,’conditions’ => array(
array(
‘field’ => ‘action’
,’value’ => ‘list’
)
),’fields’ => array(
array(
‘type’ => ‘select’
,’field’ => ‘product’
,’label’ => ‘Product’
,’columns’ => 3
,’choices’ => $products
)
,array(
‘type’ => ‘select’
,’field’ => ‘color’
,’label’ => ‘Color’
,’columns’ => 3
,’choices’ => $color
))))));
-
March 31, 2017 at 11:36 am #7876
sturpleParticipantSo I have had the same problem.
When you have a group element if you delete one of the elements that is not on the end, it saves it back to the database it uses an associated version of the array and therefore it doesn’t reload. The good news is that in the database you can fix this.
when the item gets deleted this array uses the associated version and not the indexed version. Hopefully this is making sense.
Ie
something like
[
0 = > ‘test0’,
2 = > ‘test2’,
3 => ‘test3’
]
THE FIX
Go into your database find the element convert it to array, and replace the 2, and the 3 with a 1, and a 2 respectively or what ever is your database, and then re-serialize it and it should resolve the problem.
THE TEMP FIX
Move all elements to be deleted at the bottom first before removing.I think this is in some kind of bug list, but not 100% sure, as there has been similar issues, but not exactly the same.
I hope this helps.
Regards,
Shawn -
March 31, 2017 at 4:26 pm #7882
SteveKeymasterCan you try this fix:
https://piklist.com/support/topic/0-9-9-6-add-more-problem/#post-7877 -
March 31, 2017 at 7:53 pm #7884
oferliParticipantThanks Steve, unfortunately the client already ‘updated’ the original page so all info had been lost.
I used the info in the link you suggested, hopefully this will do the trick
-
-
AuthorPosts
- The topic ‘backend is 'broken' while the front is OK’ is closed to new replies.